Re: [pgsql-performance] Deletes from tables with foreign keys taking too long

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: "Adam Siegel" <adam(at)sycamorehq(dot)com>, <pgsql-general(at)postgresql(dot)org>, <pgsql-performance(at)postgresql(dot)org>
Subject: Re: [pgsql-performance] Deletes from tables with foreign keys taking too long
Date: 2002-10-01 21:44:05
Message-ID: 200210011444.05157.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-performance

Adam,

> I have a table that has about 200 rows in it. I have 2 other tables that
> have about 300,000 rows each that reference the first table through a
> foriegn key. I run a process that rebuilds these tables. First I delete
> the rows in the large tables (takes about 30 seconds), then I delete the
> the rows in the first table (takes about 5 minutes !!!). Each of these are
> done in separate transactions.

Not that this answers your performance questions, but you will be able to do
this faster if you use TRUNCATE instead of DELETE.

--
Josh Berkus
josh(at)agliodbs(dot)com
Aglio Database Solutions
San Francisco

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Mark Wilson 2002-10-01 22:27:10 database session variables
Previous Message Tom Lane 2002-10-01 21:08:06 Re: Core Dump

Browse pgsql-performance by date

  From Date Subject
Next Message Josh Berkus 2002-10-01 21:51:29 Comparitive UPDATE speed
Previous Message Adam Siegel 2002-10-01 18:28:04 Deletes from tables with foreign keys taking too long