Re: Optimizing DELETE - Mailing list pgsql-performance

From Csaba Nagy
Subject Re: Optimizing DELETE
Date
Msg-id 1158675328.25023.216.camel@coppola.muc.ecircle.de
Whole thread Raw
In response to Optimizing DELETE  (Ivan Voras <ivoras@fer.hr>)
List pgsql-performance
> I've just fired off a "DELETE FROM table" command (i.e. unfiltered
> DELETE) on a trivially small table but with many foreign key references
> (on similar-sized tables), and I'm waiting for it to finish. It's been
> 10 minutes now, which seems very excessive for a table of 9000 rows on a
> 3 GHz desktop machine.

If you have missing indexes on the child tables foreign keys, that might
be a cause of slow delete. The cascading delete must look up the to be
deleted rows in all child tables, which will do sequential scans if you
don't have proper indexes.

Try to do an explain analyze for deleting one row, that should also show
you the time spent in triggers, which might clue you in what's taking so
long.

Cheers,
Csaba.



pgsql-performance by date:

Previous
From: "Bucky Jordan"
Date:
Subject: Re: Large tables (was: RAID 0 not as fast as expected)
Next
From: Rod Taylor
Date:
Subject: Re: Optimizing DELETE