Skip to content

Latest commit

 

History

History
17 lines (16 loc) · 393 Bytes

find-missing-indexes.md

File metadata and controls

17 lines (16 loc) · 393 Bytes
SELECT
  relname,
  seq_scan-idx_scan AS too_much_seq,
  case when seq_scan-idx_scan>0 THEN 'Missing Index?' ELSE 'OK' END,
  pg_relation_size(relname::regclass) AS rel_size,
  seq_scan,
  idx_scan
FROM
  pg_stat_all_tables
WHERE
  schemaname='public' AND
  pg_relation_size(relname::regclass)>80000
ORDER BY too_much_seq DESC;

Source