Created
May 19, 2014 18:23
-
-
Save wildintellect/fd9dff9e926eb0ffe6ff to your computer and use it in GitHub Desktop.
Listing all GIST indexes in a Postgis database.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT i.relname as indexname, | |
idx.indrelid::regclass as tablename, | |
am.amname as typename, | |
ARRAY( | |
SELECT pg_get_indexdef(idx.indexrelid, k + 1, true) | |
FROM generate_subscripts(idx.indkey, 1) as k | |
ORDER BY k | |
) as indkey_names | |
FROM pg_index as idx | |
JOIN pg_class as i | |
ON i.oid = idx.indexrelid | |
JOIN pg_am as am | |
ON i.relam = am.oid | |
JOIN pg_namespace as ns | |
ON ns.oid = i.relnamespace | |
AND ns.nspname = ANY(current_schemas(false)) | |
Where am.amname Like 'gist'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment