Re: Disk space occupied by a table in postgresql

From: hubert depesz lubaczewski <depesz(at)depesz(dot)com>
To: aravind chandu <avin_friends(at)yahoo(dot)com>
Cc: postgresql Forums <pgsql-general(at)postgresql(dot)org>
Subject: Re: Disk space occupied by a table in postgresql
Date: 2008-08-09 09:19:27
Message-ID: 20080809091927.GA8430@depesz.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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(at)depesz(dot)com
aim: depeszhdl
skype: depesz_hdl

In response to

Browse pgsql-general by date

  From Date Subject
Next Message C K 2008-08-09 12:57:40 setting datestyle
Previous Message Andreas Kretschmer 2008-08-09 09:15:14 Re: Disk space occupied by a table in postgresql