Saturday, August 9, 2008

Re: [GENERAL] Disk space occupied by a table in postgresql

On Sat, Aug 09, 2008 at 12:18:46AM -0700, aravind chandu wrote:
> I installed postgresql on linux system, I create a
> table and inserted a large data into the table
> what I would like to know is how to calculate the
> disk space occupied by the table .Is there any
> procedure to find it out or simply a command
> .Please give me some suggestion.

select pg_relation_size('table_name');
or
select pg_total_relation_size('table_name');

both return size in bytes.

pg_total_relation_size includes disk space used by indexes and external
storage (long texts are kept not in table datafile, but in separate
"toast" tables).

Best regards,

depesz

--
Linked in: http://www.linkedin.com/in/depesz
jid/gtalk
: depesz@depesz.com
aim: depeszhdl
skype: depesz_hdl

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

No comments: