Skip to content

Instantly share code, notes, and snippets.

@rafaelbernard
Last active November 2, 2017 20:20
Show Gist options
  • Save rafaelbernard/8a5b92506b0ec3e3b2f9ac2e938ed1f3 to your computer and use it in GitHub Desktop.
Save rafaelbernard/8a5b92506b0ec3e3b2f9ac2e938ed1f3 to your computer and use it in GitHub Desktop.
Indexing all columns from all tables in schema (development purpose)
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