Bruno Baguette 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 !


This will probably work for you (in bytes - or you could divide by 8 instead for KB):

select relpages*8192 from pg_class where relname = 'your_table_name';

8k page size is typical but you may need to verify this for your system. Also, there may be toast tables associated with your main table so you could need to add their sizes to your total for the table.

See the manual section on monitoring disk usage for more complete/accurate info:
http://www.postgresql.org/docs/8.1/interactive/diskusage.html


Cheers,
Steve

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

Reply via email to