Created
April 26, 2021 11:57
-
-
Save benjie/d56f9bef650e175b34bf3764579d379d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
pg_size_pretty(total_bytes) AS total, | |
pg_size_pretty(index_bytes) AS index, | |
pg_size_pretty(toast_bytes) AS toast, | |
pg_size_pretty(total_bytes - index_bytes - toast_bytes) AS table | |
FROM ( | |
SELECT | |
pg_total_relation_size(c.oid) AS total_bytes, | |
pg_indexes_size(c.oid) AS index_bytes, | |
coalesce(pg_total_relation_size(reltoastrelid), 0) AS toast_bytes | |
FROM pg_class c | |
WHERE c.oid = 'app_public.my_table_here'::regclass | |
) a; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment