From 895e24872de95acf255e0746b42f0661697e7f9a Mon Sep 17 00:00:00 2001
From: Christian Grothoff <christian@grothoff.org>
Date: Sun, 12 Jul 2020 18:19:17 +0200
Subject: initial import of thesis-dold

---
 doc/system/plots/dbsize.sql | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 doc/system/plots/dbsize.sql

(limited to 'doc/system/plots/dbsize.sql')

diff --git a/doc/system/plots/dbsize.sql b/doc/system/plots/dbsize.sql
new file mode 100644
index 00000000..4f4b2388
--- /dev/null
+++ b/doc/system/plots/dbsize.sql
@@ -0,0 +1,12 @@
+create temporary view sizes as
+  select table_name as n,
+         pg_relation_size(quote_ident(table_name)) / 1024.0 / 1024.0 as s_tbl,
+	 pg_indexes_size(quote_ident(table_name)) / 1024.0 / 1024.0 as s_idx
+   from information_schema.tables
+   where table_schema = 'public';
+
+
+select n, s_tbl, s_idx, s_tbl + s_idx from sizes where (s_tbl) != 0
+order by (s_tbl + s_idx);
+
+select sum(s_tbl), sum(s_idx), sum(s_tbl + s_idx) from sizes where s_tbl != 0;
-- 
cgit v1.2.3

