How to check all table size in postgresql - 在PostgreSQL 如何查詢資料庫所有Table的大小
May 6, 2024·
·
1 min read
Chi Yau
之前介紹了如何查詢PostgreSQL資料庫Table大小
但是如果想一次過睇曬..應該會方便一點
所以便找了一個 SQL Statement 來查詢所有Table 的大小
解法方法:
SELECT
"table_name",
pg_size_pretty(pg_total_relation_size(quote_ident("table_name"))),
pg_total_relation_size(quote_ident("table_name"))
FROM information_schema.tables
WHERE table_schema = 'public'
ORDER BY 3 DESC;

Hope you find it useful

Authors
App Dev
I’m Chi, a passionate tech enthusiast exploring the latest innovations in GenAI, LLMs, web development, performance tuning, and cybersecurity. As a tech guy at a startup, I aim to share my experiences, insights, and lessons learned in the fast-paced world of technology. Join me on this journey as we dive into the exciting challenges and triumphs of building and scaling tech solutions!