Skip site navigation (1) Skip section navigation (2)

Re: Unbearably slow cascading deletes

From: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
To: andrew(at)pillette(dot)com
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Unbearably slow cascading deletes
Date: 2004-07-21 01:37:52
Message-ID: 40FDC8F0.30102@familyhealth.com.au (view raw or flat)
Thread:
Lists: pgsql-performance
> 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 it took over four minutes to delete a parent record THAT HAD NO CHILDREN. The DB is recently analyzed and SELECTs in the child table are done by the appropriate index on the FK.

Do you have an index on the foreign key field?

Chris


In response to

pgsql-performance by date

Next:From: Rod TaylorDate: 2004-07-21 02:18:19
Subject: Re: Odd sorting behaviour
Previous:From: Ilia KantorDate: 2004-07-20 21:46:11
Subject: Index type

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group