looking for optimum select for exported keys - Mailing list pgsql-hackers

From Dave Cramer
Subject looking for optimum select for exported keys
Date
Msg-id 1023198536.1427.234.camel@inspiron.cramers
Whole thread Raw
In response to Re: Cygwin / Debian dpkg / PostgreSQL / KDE2 and 3  ("Tille, Andreas" <TilleA@rki.de>)
List pgsql-hackers
The jdbc driver has a method to return the exported keys from a table,
we require essentially what the following select returns, but it is
slow, can anyone suggest ways to optimize it?

Regards,
Dave
SELECT       c.relname as primary,       c2.relname as foreign,       t.tgconstrname,       ic.relname as fkeyname,
 af.attnum as fkeyseq,       ipc.relname as pkeyname,       ap.attnum as pkeyseq,       t.tgdeferrable,
t.tginitdeferred,      t.tgnargs,t.tgargs,       p1.proname as updaterule,       p2.proname as deleterule
 
FROM       pg_trigger t,       pg_trigger t1,       pg_class c,       pg_class c2,       pg_class ic,       pg_class
ipc,      pg_proc p1,       pg_proc p2,       pg_index if,       pg_index ip,       pg_attribute af,       pg_attribute
ap
WHERE       (t.tgrelid=c.oid       AND t.tgisconstraint       AND t.tgconstrrelid=c2.oid       AND t.tgfoid=p1.oid
and p1.proname like '%%upd')
 
       and       (t1.tgrelid=c.oid       and t1.tgisconstraint       and t1.tgconstrrelid=c2.oid       AND
t1.tgfoid=p2.oid      and p2.proname like '%%del')
 
       AND c2.relname='users'
       AND       (if.indrelid=c.oid       AND if.indexrelid=ic.oid       and ic.oid=af.attrelid       AND
if.indisprimary)
       and       (ip.indrelid=c2.oid       and ip.indexrelid=ipc.oid       and ipc.oid=ap.attrelid       and
ip.indisprimary)
;




pgsql-hackers by date:

Previous
From: "Tille, Andreas"
Date:
Subject: Re: Cygwin / Debian dpkg / PostgreSQL / KDE2 and 3
Next
From: Bruce Momjian
Date:
Subject: Re: pgaccess