Re: Delete query takes exorbitant amount of time

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Karim Nassar <karim(dot)nassar(at)NAU(dot)EDU>
Cc: pgsql-performance(at)postgreSQL(dot)org
Subject: Re: Delete query takes exorbitant amount of time
Date: 2005-03-25 01:48:38
Message-ID: 3750.1111715318@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Karim Nassar <karim(dot)nassar(at)NAU(dot)EDU> writes:
>> Look at what your triggers are doing. My private bet is that you have
>> unindexed foreign keys referencing this table, and so each deletion
>> forces a seqscan of some other, evidently very large, table(s).

> Almost. I have a large table (6.3 million rows) with a foreign key
> reference to this one (which has 749 rows), however it is indexed.

In that case there's a datatype mismatch between the referencing and
referenced columns, which prevents the index from being used for the
FK check.

regards, tom lane

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2005-03-25 02:32:56 Re: Delete query takes exorbitant amount of time
Previous Message Karim Nassar 2005-03-25 01:48:24 Re: Delete query takes exorbitant amount of time