Search Postgresql Archives

Re: Postgres Database size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 2007-03-18 at 00:40 +0530, Mageshwaran wrote:
> how to find the size of a particular database in postgres...

The old way was to use du or similar. Recent versions (I believe >=8.1,
but check the release notes to be sure) provide several useful functions
for this:
 pg_column_size
 pg_database_size
 pg_relation_size
 pg_size_pretty
 pg_tablespace_size
 pg_total_relation_size


For example:

rkh@csb-dev=> select datname,pg_size_pretty(pg_database_size(oid)) from
pg_database ;
           datname           | pg_size_pretty 
-----------------------------+----------------
 postgres                    | 3905 kB
 csb                         | 113 GB
 template0                   | 3840 kB
 csb-dev                     | 124 GB
 csb-dev-snapshot-2007-03-08 | 123 GB
 csb_02_02_2007              | 121 GB
 template1                   | 3840 kB


-- 
Reece Hart, http://harts.net/reece/, GPG:0x25EC91A0
./universe -G 6.672e-11 -e 1.602e-19 -protonmass 1.673e-27 -uspres bush
kernel warning: universe consuming too many resources. Killing.
universe killed due to catastrophic leadership. Try -uspres carter.



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux