Skip to content

Instantly share code, notes, and snippets.

@sahglie
Forked from jberkus/gist:de7cfdd3b6e0b187f63d
Last active August 29, 2015 14:07
Show Gist options
  • Save sahglie/06f24d8154f1fd72d5a5 to your computer and use it in GitHub Desktop.
Save sahglie/06f24d8154f1fd72d5a5 to your computer and use it in GitHub Desktop.
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