-
-
Save sumanthkumarc/37d94b4f4d5e1fb9c5b76ce182c73dfb to your computer and use it in GitHub Desktop.
Find disk size of Postgres materialized view
This file contains hidden or 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
/* | |
https://dba.stackexchange.com/questions/96534/postgres-check-disk-space-taken-by-materialized-view?newreg=6b1d58604fce4a1fbe3033ddbb52d7ca | |
relkind: | |
r = ordinary table, | |
i = index, | |
S = sequence, | |
v = view, | |
m = materialized view, | |
c = composite type, | |
t = TOAST table, | |
f = foreign table | |
*/ | |
SELECT relname AS objectname | |
, relkind AS objecttype | |
, reltuples AS entries | |
, pg_size_pretty(pg_table_size(oid)) AS size -- depending - see below | |
FROM pg_class | |
WHERE relkind IN ('m') | |
ORDER BY pg_table_size(oid) DESC; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment