Re: How can I known the size of a database, table by table ? - Mailing list pgsql-general

From Shoaib Mir
Subject Re: How can I known the size of a database, table by table ?
Date
Msg-id bf54be870603270938w28798f9blc61b5c98e58074a5@mail.gmail.com
Whole thread Raw
In response to How can I known the size of a database, table by table ?  (Bruno Baguette <pgsql-ml@baguette.net>)
List pgsql-general
The space occupied by your database and tables can be found this way:

# select oid from pg_database where datname='mybase';

 oid 
-------
 17239
(1 row)

$ du -hs data/base/17239
13.5 M

For getting a table size to get an approx size you can do the following:

SELECT relpages * 8192 AS size_in_bytes
FROM pg_class
WHERE

relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = '<schema name>') AND

   relname = '<table name>';

/Shoaib



On 3/27/06, Bruno Baguette < pgsql-ml@baguette.net> wrote:
Hello,

I works on a PostgreSQL 8.0.4 database, and I would like to known the
size (in bytes, Mbytes or anything else) of that database, for each table.

How can I do that ?

Thanks in advance !

--
Bruno BAGUETTE

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

pgsql-general by date:

Previous
From: Andreas Kretschmer
Date:
Subject: Re: How can I known the size of a database, table by table ?
Next
From: Chris Travers
Date:
Subject: Re: Advantages of PostgreSQL over MySQL 5.0