We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
Here is an SQL statement to get the size of all your PostgreSQL databases.
SELECT
d.datname AS Name,
pg_catalog.pg_get_userbyid(d.datdba) AS Owner,
CASE WHEN pg_catalog.has_database_privilege(d.datname, 'CONNECT') THEN pg_catalog.pg_size_pretty(
pg_catalog.pg_database_size(d.datname)
) ELSE 'No Access' END AS SIZE
FROM
pg_catalog.pg_database d
ORDER BY
CASE WHEN pg_catalog.has_database_privilege(d.datname, 'CONNECT') THEN pg_catalog.pg_database_size(d.datname) ELSE NULL END DESC;
If this post was enjoyable or useful for you, please share it! If you have comments, questions, or feedback, you can email my personal email. To get new posts, subscribe use the RSS feed.