Re: Poor performance of delete by primary key - Mailing list pgsql-performance

From Tom Lane
Subject Re: Poor performance of delete by primary key
Date
Msg-id 19191.1126028579@sss.pgh.pa.us
Whole thread Raw
In response to Re: Poor performance of delete by primary key  (Mark Lewis <mark.lewis@mir3.com>)
List pgsql-performance
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

pgsql-performance by date:

Previous
From: "Merlin Moncure"
Date:
Subject: Re: insert performance for win32
Next
From: Carlos Henrique Reimer
Date:
Subject: log_duration times