Skip to content

Instantly share code, notes, and snippets.

@jayelkaake
jayelkaake / locks.sql
Last active October 23, 2018 22:32 — forked from zm69/locks_and_blocking.sql
PSQL Useful Queries
-- See summary of table sizes (index and storage sizes) sorted by largest size to smallest size
SELECT
table_name,
pg_size_pretty(table_size) AS table_size,
pg_size_pretty(indexes_size) AS indexes_size,
pg_size_pretty(total_size) AS total_size,
ROUND(indexes_size/1024/1024) as indexes_size_mb,
ROUND(table_size/1024/1024) as table_size_mb,
ROUND(total_size/1024/1024) as total_size_mb
FROM (