Re: [PERFORM] Unbearably slow cascading deletes

2004-07-20 Thread Christopher Kings-Lynne
I have (among other things) a parent table with 200 records and a child table with 20MM or more. I set up referential integrity on the FK with ON DELETE CASCADE. It appears that when a DELETE is done on the parent table, the child table deletion is done with a sequential scan. I say this because i

Re: [PERFORM] Unbearably slow cascading deletes

2004-07-20 Thread andrew
I FOUND IT! A second trigger that doesn't belong.. OK, we're set now, and thanks for showing me some ways to check what the planner is up to. Is there a way of seeing what the triggers will do? ---(end of broadcast)--- TIP 4: Don't 'kill -9' t

Re: [PERFORM] Unbearably slow cascading deletes

2004-07-20 Thread andrew
PREPARE c(int4) AS DELETE FROM childtable WHERE fk=$1; EXPLAIN EXECUTE c(-1); gives an index scan. PREPARE c2(int4) AS DELETE FROM parenttable WHERE key=$1; EXPLAIN EXECUTE c2(1); gives a seq scan on the parent table (itself a little curious) and no explanation of what the triggers are doing.

Re: [PERFORM] Unbearably slow cascading deletes

2004-07-20 Thread Stephan Szabo
On Tue, 20 Jul 2004, Stephan Szabo wrote: > > On Tue, 20 Jul 2004 [EMAIL PROTECTED] wrote: > > > I have (among other things) a parent table with 200 records and a child > > table with 20MM or more. I set up referential integrity on the FK with > > ON DELETE CASCADE. > > > > It appears that when a

Re: [PERFORM] Unbearably slow cascading deletes

2004-07-20 Thread Stephan Szabo
On Tue, 20 Jul 2004 [EMAIL PROTECTED] wrote: > I have (among other things) a parent table with 200 records and a child > table with 20MM or more. I set up referential integrity on the FK with > ON DELETE CASCADE. > > It appears that when a DELETE is done on the parent table, the child > table del