Search Postgresql Archives

Re: Postgres Database size

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

 



I have been looking for such a function. Having Just upgraded to 8.2, this function is a very welcome addition to my arsenal of tools.
Many thanks!
- Naz.

Reece Hart wrote:
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


  

[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