Guest User

Untitled

a guest
Feb 17th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. SELECT
  2. relname AS TableName,
  3. to_char(seq_scan, '999,999,999,999') AS TotalSeqScan,
  4. to_char(idx_scan, '999,999,999,999') AS TotalIndexScan,
  5. to_char(n_live_tup, '999,999,999,999') AS TableRows,
  6. pg_size_pretty(pg_relation_size(relname :: regclass)) AS TableSize
  7. FROM pg_stat_all_tables
  8. WHERE schemaname = 'public'
  9. AND 50 * seq_scan > idx_scan -- more then 2%
  10. AND n_live_tup > 10000
  11. AND pg_relation_size(relname :: regclass) > 5000000
  12. ORDER BY relname ASC;
Add Comment
Please, Sign In to add comment