Wednesday, November 17, 2010

Top 20 tables acording to sequential scan in Postgresql

select c.relname as name, c.reltuples as No_of_records, c.relpages as  No_of_pages,
   pg_size_pretty(pg_relation_size(c.relname)) as size,
   t.seq_scan, t.seq_tup_read, t.idx_scan, t.idx_tup_fetch, t.n_tup_ins, t.n_tup_upd, t.n_tup_del,
   COALESCE(t.idx_tup_fetch,0) + COALESCE(t.seq_tup_read,0) as total_read
from pg_stat_user_tables as t inner join pg_class as c
         on (t.relid = c.oid)
where c.relkind ='r'
order by seq_scan desc
limit 20

One Response so far

  1. This is really very nice post you shared, i like the post, thanks for sharing.. Androvid video editor live nettv latest version CShare apk

Leave a Reply