Last active
June 7, 2024 06:31
-
-
Save dadhi/25f0a3e3d11175e073bc280aa770e9e4 to your computer and use it in GitHub Desktop.
Find disk size of Postgres materialized view
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
/* | |
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