Re: slow query : very simple delete, 100% cpu, nearly no disk activity - Mailing list pgsql-performance

From Tom Lane
Subject Re: slow query : very simple delete, 100% cpu, nearly no disk activity
Date
Msg-id 16500.1252286723@sss.pgh.pa.us
Whole thread Raw
In response to slow query : very simple delete, 100% cpu, nearly no disk activity  (Vincent de Phily <vincent.dephily@mobile-devices.fr>)
Responses Re: slow query : very simple delete, 100% cpu, nearly no disk activity  (Vincent de Phily <vincent.dephily@mobile-devices.fr>)
List pgsql-performance
Vincent de Phily <vincent.dephily@mobile-devices.fr> writes:
> I've been running this simple delete since yesterday afternoon :
>> db=# explain delete from message where datetime < '2009-03-03';
>> Seq Scan on message  (cost=0.00..34131.95 rows=133158 width=6)
>> Filter: (datetime < '2009-03-03 00:00:00'::timestamp without time zone)

> There is no index on that column, so a seqscan is fine. But it really
> shouldn't take > 15 hours to delete :

99% of the time, the reason a delete takes way longer than it seems like
it should is trigger firing time.  In particular, foreign key triggers
where you don't have an index on the referencing column.  Are there
any foreign keys linking to this table?

            regards, tom lane

pgsql-performance by date:

Previous
From: Vincent de Phily
Date:
Subject: slow query : very simple delete, 100% cpu, nearly no disk activity
Next
From: Reydan Cankur
Date:
Subject: Using Gprof with Postgresql