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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Vincent de Phily <vincent.dephily@xxxxxxxxxxxxxxxxx> 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

-- 
Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance

[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux