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:

[EMAIL PROTECTED]> 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.


---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to [EMAIL PROTECTED] so that your
       message can get through to the mailing list cleanly

Reply via email to