Last active
November 16, 2016 20:36
-
-
Save nini/901f2d2b66b69f7d384a75461064f1b8 to your computer and use it in GitHub Desktop.
Get complete index list for particular table as SQL
This file contains hidden or 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 pg_get_indexdef(idx.oid)||';' | |
from pg_index ind | |
join pg_class idx on idx.oid = ind.indexrelid | |
join pg_class tbl on tbl.oid = ind.indrelid | |
left join pg_namespace ns on ns.oid = tbl.relnamespace | |
where tbl.relname = 'mytablename' | |
and ns.nspname = 'public'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment