gerhard <g(dot)hintermayer(at)inode(dot)at> writes:
> oops, should have thought about setting the foreign key constraint
> deferrable, maybe showing this in table definition (\d) would be a
> good idea.
Don't think that'll make any difference. What *should* help is having
an index on downtime_detail.downtimeid. As-is it's got to seqscan
downtime_detail to look for rows to be cascade-deleted.
regards, tom lane