I have a php application that needs to query the PK of a table - I'm currently using this from the information_schema views: SELECT column_name FROM information_schema.table_constraints tc INNER JOIN information_schema.constraint_column_usage ccu ON tc.constraint_name = ccu.constraint_name AND tc.constraint_schema = ccu.constraint_schema WHERE constraint_type = 'PRIMARY KEY' AND tc.table_name = '$table' AND tc.table_schema = '$schema' This is an extremely slow query tho. The top/bottom of my EXPLAIN ANALYZE (8.1.9): Nested Loop (cost=22.20..342.24 rows=1 width=64) (actual time=68985.008..68988.784 rows=1 loops=1) Join Filter: ("inner".oid = "outer".relnamespace) -> Nested Loop (cost=22.20..341.15 rows=1 width=68) (actual time=68984.922..68988.694 rows=1 loops=1) <snip about 60 rows> Total runtime: 68989.637 ms I can put the full explain output on the web if it's useful. Curious if there is a better/cheaper way to get the data I'm looking for though? Thanks, Josh ---------------------------(end of broadcast)--------------------------- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to majordomo@xxxxxxxxxxxxxx so that your message can get through to the mailing list cleanly