Re: Disk space occupied by a table in postgresql

From: Reid Thompson <Reid(dot)Thompson(at)ateb(dot)com>
To: Fouad Zaryouh <fouad(dot)zaryouh(at)gmail(dot)com>
Cc: aravind chandu <avin_friends(at)yahoo(dot)com>, postgresql Forums <pgsql-general(at)postgresql(dot)org>
Subject: Re: Disk space occupied by a table in postgresql
Date: 2008-08-13 11:27:13
Message-ID: 1218626833.29951.18.camel@raker.ateb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, 2008-08-09 at 04:59 -0400, Fouad Zaryouh wrote:
> Hi Aravind,
>
> Run the following query
>
> SELECT relname, reltuples, relpages * 8 / 1024 AS "MB" FROM pg_class
> ORDER BY relpages DESC;
>
>
>
> relname = table name
> relpages = size in MB
> reltuples = number of rows.
>
> Hope this help.
>
>
>
> Fouad Zaryouh
>
> http://www.flipcore.com
>
>
>
>
> On Sat, Aug 9, 2008 at 3:18 AM, aravind chandu
> <avin_friends(at)yahoo(dot)com> wrote:
> Hello,
>
> 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.
>
>
> Thank You,
> Avin.
>
>
>
>

This may be of use in recent versions...
select pg_size_pretty(pg_database_size('table_name'))

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2008-08-13 11:29:09 Re: Alias for function return buffer in pl/pgsql?
Previous Message Raymond O'Donnell 2008-08-13 11:16:20 Re: psql tutorial