Search Postgresql Archives

Re: pg_database_size(oid)

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

 



Dhimant Patel wrote:
I have created a database, which I plan to load with several tables. I am trying to find the size of the databases and came across pg_database_size(oid) function.

Here's what you probably want:

select datname,pg_size_pretty(pg_database_size(pg_database.oid)) from pg_database order by pg_database_size(pg_database.oid) desc;

The OID in these are sort of hidden column, there's a list of them all at http://www.postgresql.org/docs/current/static/ddl-system-columns.html

Most tables will not have an OID nowadays, but many of the system catalog ones still do. ctid is another handy one to know about--useful for removing duplicate records and some other fancy tricks.



--
Greg Smith  2ndQuadrant US  Baltimore, MD
PostgreSQL Training, Services and Support
greg@xxxxxxxxxxxxxxx   www.2ndQuadrant.us


--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[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