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) ; ---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster