sexta-feira, setembro 02, 2011

Postgres: Qual o tamanho do banco de dados no seu sistema de arquivos (disco) ?

... na linha de comando, através do 'psql' 




postgres=# SELECT pg_database.datname,
postgres-# pg_size_pretty(pg_database_size(pg_database.datname)) AS size
postgres-# FROM pg_database;


datname | size
------------------+---------
template1 | 4272 kB
template0 | 4272 kB
postgres | 4364 kB
znc | 4272 kB
teste | 8128 kB
template_postgis | 7416 kB
circuitonobre | 8336 kB
postfix | 4908 kB
teste | 11 MB
znc_gerencia | 9048 kB
pam | 14 MB
tnc_uc | 48 MB
(12 rows)


postgres=# SELECT pg_size_pretty(pg_database_size('sorocaba_sig')) As fulldbsize;


fulldbsize
------------
8568 kB
(1 row)


postgres=# SELECT pg_database.datname,
pg_size_pretty(pg_database_size(pg_database.datname)) AS size
FROM pg_database where datname = 'sorocaba_sig';


datname | size
--------------+---------
sorocaba_sig | 8568 kB
(1 row)