Re: DELETE SQL too slow.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Diogo Biazus <diogo(at)ikono(dot)com(dot)br>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: DELETE SQL too slow.
Date: 2002-09-03 14:35:13
Message-ID: 6017.1031063713@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Diogo Biazus <diogo(at)ikono(dot)com(dot)br> writes:
> I'm having problems with delete commands in postgres. They are too slow.
> I'm trying to delete a set o 300 rows in table with 50000 rows with a
> simple command like:

> DELETE FROM table WHERE field1 = '4'

> When I run the explain it tells me that index_scan is being used. But to
> complete the delete it takes more than 30 minutes and the CPU use never
> rise above 10%.

I'm betting this table is referenced by foreign key constraints on other
tables, and you are missing some needed indexes on those other tables.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Darren Ferguson 2002-09-03 14:56:28 Re: Why must the function that a trigger calls return
Previous Message Tom Lane 2002-09-03 14:32:47 Re: Call closed: Almost happy ending (from "Data files became huge with no apparent reason" thread)