Delete Performance question

From: Niederland <niederland(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Delete Performance question
Date: 2007-07-03 01:28:40
Message-ID: 1183426120.424666.143610@i13g2000prf.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I did an analyize and tried to delete 50 rows from the 1.5M table and
it took over 120 seconds.
Deleting 100 rows took nearly twice as long.

An explain of the delete query showed that indexes were being used.

I found that changing the variable enable_seqscan = off and restarting
the database, deleting 50 rows took less then two seconds. 500 rows
was quick as well.
The explain output does not indicate how the foreign keys are
processed.

Do I just have to set the varible locally on the connection? Is this
what is expected?

BackGround:
Postgresql 8.2.4
184 tables in schema of interest.
table of interest has about 1.5M rows.

This table references 30 other tables via foreign keys. All foreign
keys are "on update restrict on delete restrict", except 2 are "on
update restrict on delete set null. (No cascading deletes)
Two other tables reference this table.
btree indexes exist on the foreign key and also the referenced table's
referenced field (primary key).

I verified all of these foreign key / referenced field use the same
datatype.

Browse pgsql-general by date

  From Date Subject
Next Message Ron Johnson 2007-07-03 03:21:55 Re: What O/S or hardware feature would be useful for databases?
Previous Message Terry Fielder 2007-07-03 00:56:17 Re: Insert speed new post