Search Postgresql Archives

Re: How can I known the size of a database, table by table

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

 



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


[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