Re: pg_database_size(oid)

From: Reid Thompson <reid(dot)thompson(at)ateb(dot)com>
To: pgsql-general(at)postgresql(dot)org
Cc: reid(dot)thompson(at)ateb(dot)com
Subject: Re: pg_database_size(oid)
Date: 2010-02-17 18:52:06
Message-ID: 1266432726.1447.6.camel@raker.ateb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 2010-02-17 at 11:59 -0500, 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. Since it requires databse oid,
> I thought there must be a view where you get it - then came across
> "pg_database" table and still all in vain. The "pg_database" table
> lists all databases in the server but won't provide me the oid
> for pg_database_size().
>
>
> I noticed this being true for almost all reference views. For example,
> pg_tablespace lists the tablespaces but no tablespace oid.
> Function pg_tablespace_databases (tablespace_oid) ,
> needs tablespace_oid, but where I could get it from?

Use the db name.

test=# select pg_size_pretty(pg_database_size('test'));
pg_size_pretty
----------------
5392 kB
(1 row)

test=#

In response to

Browse pgsql-general by date

  From Date Subject
Next Message mike stanton 2010-02-17 20:02:28 Reading a table with composite type, into it equivalent c structure
Previous Message Tom Lane 2010-02-17 17:16:41 Re: pg_database_size(oid)