Skip to content

Instantly share code, notes, and snippets.

@GraphBear
Created May 18, 2017 21:24
Show Gist options
  • Save GraphBear/534f33d0ae25bedb4da4b26a90f24c74 to your computer and use it in GitHub Desktop.
Save GraphBear/534f33d0ae25bedb4da4b26a90f24c74 to your computer and use it in GitHub Desktop.
postgres indexes sorted by size
SELECT
relname AS name,
pg_size_pretty(sum(relpages::bigint*current_setting('block_size')::bigint)::bigint) AS size
FROM
pg_class
WHERE
reltype=0
GROUP BY
relname
ORDER BY
sum(relpages)
DESC LIMIT 20;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment