Skip to content

Instantly share code, notes, and snippets.

@Charmatzis
Created May 16, 2024 11:15
Show Gist options
  • Save Charmatzis/e5781bdaa3a18a7ecad3aec22fd216e3 to your computer and use it in GitHub Desktop.
Save Charmatzis/e5781bdaa3a18a7ecad3aec22fd216e3 to your computer and use it in GitHub Desktop.
Get all indexes DDL for Postgres
select pg_get_indexdef(format('%I.%I', schemaname, indexname)::regclass)
from pg_indexes
where schemaname not in ('pg_catalog', 'information_schema')
and schemaname not like 'pg_temp%';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment