Skip to content

Instantly share code, notes, and snippets.

@areguig
Created March 23, 2017 14:23
Show Gist options
  • Save areguig/c5b446b93dc39d6abd146eab50b68c1e to your computer and use it in GitHub Desktop.
Save areguig/c5b446b93dc39d6abd146eab50b68c1e to your computer and use it in GitHub Desktop.
Estimated dead rows, initiated sequences and indexes scans on tables.
select relname,(n_dead_tup+n_live_tup) as estimated_total_rows, n_dead_tup as estimated_dead_rows,
seq_scan,idx_scan
from pg_catalog.pg_stat_all_tables
where n_dead_tup > 0
-- and relname = '<TABLE_NAME>'
and schemaname='<SCHEMA_NAME>'
order by n_dead_tup desc;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment