Created
October 8, 2014 21:28
-
-
Save jberkus/de7cfdd3b6e0b187f63d to your computer and use it in GitHub Desktop.
finding needed indexes -- early draft
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 schemaname, relname, | |
seq_scan as table_scans, | |
idx_scan as index_scans, | |
pg_size_pretty(pg_relation_size(relid)) as table_size, | |
n_tup_ins + n_tup_del + n_tup_upd + n_tup_hot_upd as write_activty | |
FROM pg_stat_user_tables | |
WHERE seq_scan > 1000 | |
AND seq_scan > ( idx_scan / 10 ) | |
AND pg_relation_size(relid) > ( 16000000 ) | |
ORDER BY pg_relation_size(relid) desc; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment