Advertisement
Dyrcona

usertuples.sql

Mar 4th, 2021
1,568
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Cribbed from https://www.dbrnd.com/2016/10/postgresql-script-to-find-total-live-tuples-and-dead-tuples-row-of-a-table-execute-vacuum-remove-fragmentation-improve-performance/
  2. SELECT
  3.     schemaname || '.' || relname AS TableName
  4.     ,n_live_tup AS LiveTuples
  5.     ,n_dead_tup AS DeadTuples
  6. FROM pg_stat_user_tables
  7. WHERE n_live_tup > 0
  8. ORDER by n_dead_tup DESC;
  9.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement