aboutsummaryrefslogtreecommitdiff
path: root/doc/system/plots/dbsize.sql
blob: 4f4b23886af45a3ecdf784124f4a72232af1d309 (plain)
1
2
3
4
5
6
7
8
9
10
11
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;