We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e762894 commit e558c91Copy full SHA for e558c91
postgres/scripts/show_table_sizes.sql
@@ -0,0 +1,17 @@
1
+-- Show a list of biggest tables and indices
2
+-- ordered by decreasing size.
3
+-- Runs instantly.
4
+SELECT
5
+ schema_name,
6
+ relname,
7
+ pg_size_pretty(table_size) AS size,
8
+ table_size
9
+FROM (
10
+ SELECT
11
+ pg_catalog.pg_namespace.nspname AS schema_name,
12
13
+ pg_relation_size(pg_catalog.pg_class.oid) AS table_size
14
+ FROM pg_catalog.pg_class
15
+ JOIN pg_catalog.pg_namespace ON relnamespace = pg_catalog.pg_namespace.oid
16
+ ) t
17
+WHERE schema_name = 'public' AND table_size > 0 ORDER BY table_size DESC;
0 commit comments