Re: slow query : very simple delete, 100% cpu, nearly no disk activity

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Vincent de Phily <vincent(dot)dephily(at)mobile-devices(dot)fr>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: slow query : very simple delete, 100% cpu, nearly no disk activity
Date: 2009-09-07 01:25:23
Message-ID: 16500.1252286723@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Vincent de Phily <vincent(dot)dephily(at)mobile-devices(dot)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

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Vincent de Phily 2009-09-07 09:05:02 Re: slow query : very simple delete, 100% cpu, nearly no disk activity
Previous Message Merlin Moncure 2009-09-06 05:36:24 Re: Planner question - "bit" data types