Last active
November 2, 2017 20:20
-
-
Save rafaelbernard/8a5b92506b0ec3e3b2f9ac2e938ed1f3 to your computer and use it in GitHub Desktop.
Indexing all columns from all tables in schema (development purpose)
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 'CREATE INDEX ' || table_name || '_' || column_name || ' ON ' || table_schema || '.' || table_name || ' ("' || column_name || '");' | |
FROM information_schema.columns | |
WHERE table_schema = 'public' | |
AND table_name != 'pg_stat_statements' | |
AND table_name != 'pg_buffercache'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment