How to check all table size in postgresql - 在PostgreSQL 如何查詢資料庫所有Table的大小

Check table size in postgresql

之前介紹了如何查詢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;

Query to check PostgreSQL all table size
Query to check PostgreSQL all table size

Hope you find it useful

Chi Yau
Chi Yau
Software Engineer

Interested on Learning new stuff and experience sharing