Created
February 22, 2021 18:57
-
-
Save schwartzmx/3777a1c73d350e1cd5825246e79a16b8 to your computer and use it in GitHub Desktop.
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
SELECT c.relname AS "Name", | |
CASE c.relkind WHEN 'r' THEN 'table' WHEN 'm' THEN 'materialized view' ELSE 'view' END AS "Engine", | |
pg_relation_size(c.oid) AS "Data_length", | |
pg_total_relation_size(c.oid) - pg_relation_size(c.oid) AS "Index_length", | |
obj_description(c.oid, 'pg_class') AS "Comment", | |
CASE WHEN c.relhasoids THEN 'oid' ELSE '' END AS "Oid", | |
c.reltuples as "Rows", | |
n.nspname | |
FROM pg_class c | |
JOIN pg_namespace n ON(n.nspname = current_schema() AND n.oid = c.relnamespace) | |
WHERE relkind IN ('r', 'm', 'v', 'f', 'p') | |
ORDER BY relname |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment