"Andy" <frum(at)ar-sd(dot)net> writes:
> EXPLAIN ANALYZE
> DELETE FROM report WHERE id_order IN
> ...
> Hash IN Join (cost=3532.83..8182.33 rows=32042 width=6) (actual
> time=923.456..2457.323 rows=59557 loops=1)
> ...
> Total runtime: 456718.658 ms
So the runtime is all in the delete triggers. The usual conclusion from
this is that there is a foreign key column pointing at this table that
does not have an index, or is not the same datatype as the column it
references. Either condition will force a fairly inefficient way of
handling the FK deletion check.
regards, tom lane