changeset 2510:cdc491306fef

About pg_relation_size.
author Oleksandr Gavenko <gavenkoa@gmail.com>
date Tue, 08 Jun 2021 17:06:25 +0300
parents 6a1fb2d1bee7
children ead0982db652
files postgres.rst
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/postgres.rst	Tue Jun 08 16:50:18 2021 +0300
+++ b/postgres.rst	Tue Jun 08 17:06:25 2021 +0300
@@ -449,7 +449,7 @@
 
   SELECT pg_table_size('schemaname.tablename');
 
-Sole table size (without indexes and other)::
+Sole table size (without indexes and TOAST)::
 
   SELECT pg_size_pretty(pg_relation_size('schemaname.tablename'));
 
@@ -460,6 +460,10 @@
   SELECT relname, relpages FROM pg_class ORDER BY relpages DESC;
   SELECT relname, pg_size_pretty(pg_relation_size(p.oid)) FROM pg_class ORDER BY relpages DESC;
 
+  SELECT pg_table_size(t.schemaname ||'.'|| t.tablename), pg_relation_size(t.schemaname ||'.'|| t.tablename), t.*
+  FROM pg_tables t
+  ORDER BY 1 DESC;
+
 Largest tables with TOAST::
 
   SELECT p.relname, t.relname, pg_size_pretty(pg_relation_size(p.oid)), p.relpages