?column?
----------
1607
(1 row)
VCDB=# select pg_size_pretty(pg_database_size( current_database() )) as human_size , pg_database_size (current_database() ) as raw_size;
human_size | raw_size
------------+------------
1607 MB | 1685410936
(1 row)
VCDB=# select pg_database_size(current_database())/1024/1024/1024 as size_in_gig;
size_in_gig
-------------
1
(1 row)
Looking at entire database size
VCDB=# \d pg_database;
Table "pg_catalog.pg_database"
Column | Type | Modifiers
---------------+-----------+-----------
datname | name | not null
datdba | oid | not null
encoding | integer | not null
datcollate | name | not null
datctype | name | not null
datistemplate | boolean | not null
datallowconn | boolean | not null
datconnlimit | integer | not null
datlastsysoid | oid | not null
datfrozenxid | xid | not null
dattablespace | oid | not null
datacl | aclitem[] |
Indexes:
"pg_database_datname_index" UNIQUE, btree (datname), tablespace "pg_global"
"pg_database_oid_index" UNIQUE, btree (oid), tablespace "pg_global"
Tablespace: "pg_global"
VCDB=# select datname, pg_database_size(datname)/1024/1024 as size_in_Megabytes from pg_database order by 2 desc;
datname | size_in_megabytes
--------------+-------------------
VCDB1 | 21239
VCDB2 | 3604
VCDB3 | 1613
VCDB | 1607
VCDB4 | 943
VCDB5 | 174
VCDB6 | 34
VCDB7 | 25
VCDB8 | 20
VCDB9 | 18
VCDB10 | 7
VCDB11 | 7
template0 | 6
template1 | 6
VCDB12 | 6
VCDB13 | 5
postgres | 5
(17 rows)
Total database size
select sum(pg_database_size(datname))/1024/1024/1024 as size_in_gig from pg_database;
No comments:
Post a Comment