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