Mark Lewis <mark.lewis@mir3.com> writes:
> I had a similar problem, so I downloaded 8.1 from CVS, ran it on a
> relatively gnarly dev workstation, imported a dump of my 8.0 database,
> and ran my troublesome queries with the new EXPLAIN ANALYZE.
> This process took about an hour and worked great, provided that you've
> actually named your foreign key constraints. Otherwise, you'll find out
> that there's a trigger for a constraint called $3 that's taking up all
> of your time, but you won't know what table that constraint is on.
But at least you've got something you can work with. Once you know the
name of the problem trigger you can look in pg_trigger to see which
other table it's connected to. Try something like
select tgname, tgconstrrelid::regclass, tgargs from pg_trigger
where tgrelid = 'mytable'::regclass;
regards, tom lane