summaryrefslogtreecommitdiff
path: root/doc/system/plots/dbsize.sql
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-07-12 18:19:17 +0200
committerChristian Grothoff <christian@grothoff.org>2020-07-12 18:19:17 +0200
commit895e24872de95acf255e0746b42f0661697e7f9a (patch)
treeb2aadbb712549f7aa9caf8679036e9f1535a4f2c /doc/system/plots/dbsize.sql
parent4d298f9bea8a98acc5d4b7d738af02313b203658 (diff)
downloadexchange-895e24872de95acf255e0746b42f0661697e7f9a.tar.gz
exchange-895e24872de95acf255e0746b42f0661697e7f9a.tar.bz2
exchange-895e24872de95acf255e0746b42f0661697e7f9a.zip
initial import of thesis-dold
Diffstat (limited to 'doc/system/plots/dbsize.sql')
-rw-r--r--doc/system/plots/dbsize.sql12
1 files changed, 12 insertions, 0 deletions
diff --git a/doc/system/plots/dbsize.sql b/doc/system/plots/dbsize.sql
new file mode 100644
index 000000000..4f4b23886
--- /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;