February 2020
Intermediate to advanced
734 pages
38h 13m
English
Follow these steps to learn a little about the database:
SELECT oid::REGCLASS::TEXT AS table_name,
pg_size_pretty(
pg_total_relation_size(oid)
) AS total_size
FROM pg_class
WHERE relkind = 'r'
AND relpages > 0
ORDER BY pg_total_relation_size(oid) DESC
LIMIT 20;
SELECT indexrelid::REGCLASS::TEXT AS index_name,
indrelid::REGCLASS::TEXT AS table_name,
pg_size_pretty(
pg_relation_size(indexrelid)
) AS total_size
FROM pg_index
ORDER BY pg_relation_size(indexrelid) DESC
LIMIT 20;
Read now
Unlock full access