Skip to content

Instantly share code, notes, and snippets.

@slabad
Last active June 8, 2020 15:22
Show Gist options
  • Save slabad/30b3a0c20a891a77b5164d08a7e9be9c to your computer and use it in GitHub Desktop.
Save slabad/30b3a0c20a891a77b5164d08a7e9be9c to your computer and use it in GitHub Desktop.
live and dead tuples #postgres #psql
SELECT
schemaname
,relname AS TableName
,n_live_tup AS LiveTuples
,n_dead_tup AS DeadTuples
FROM pg_stat_user_tables
ORDER BY n_live_tup DESC
;
SELECT
relname AS ObjectName
,pg_stat_get_live_tuples(c.oid) AS LiveTuples
,pg_stat_get_dead_tuples(c.oid) AS DeadTuples
FROM pg_class c;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment