I've applied a patch for this problem to current sources. The
improvement was more than I expected --- a test case involving
deleting 80000 tuples from a foreign-key-referencing table dropped
from ~15min to ~8sec. Insertion of a large number of tuples in one
transaction sped up quite a bit too.
If you are in a hurry for a fix, you could probably adapt the diff
to 7.0.3 sources:
http://www.postgresql.org/cgi/cvsweb.cgi/pgsql/src/backend/commands/trigger.c.diff?r1=1.86&r2=1.87&f=c
regards, tom lane