Re: Table size

From: Guillaume Lelarge <guillaume(at)lelarge(dot)info>
To: Greg Smith <greg(at)2ndquadrant(dot)com>
Cc: Benjamin Krajmalnik <kraj(at)illumen(dot)com>, pgadmin-support(at)postgresql(dot)org
Subject: Re: Table size
Date: 2010-02-08 10:41:00
Message-ID: 4B6FEA3C.8080808@lelarge.info
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support

Le 05/02/2010 11:57, Greg Smith a écrit :
> Benjamin Krajmalnik wrote:
>>
>> In pgAdmin, one can view the total disk size occupied by a table in
>> the statistics view when in the “Tables” context.
>>
>> What query is being used to calculate this?
>>
>> I have found pg_relation_size() but it has to be called for multiple
>> entities in order to arrive at the total utilization.
>>
>
> I believe it's using pg_total_relation_size() there:
> http://www.postgresql.org/docs/current/interactive/functions-admin.html
>
> There are some sample queries to compute disk use information in a
> couple of different forms at http://wiki.postgresql.org/wiki/Disk_Usage
> you might find handy too.
>

Nope. We are using:

* pg_relation_size on the table OID for the "Table Size" row,
* a sum of pg_relation_size for all indexes on this table for the
"Indexes Size" row,
* and a sum of the pg_relation_size of the TOAST table size and of the
pg_relation_size of the TOAST indexes for the "Toast Table Size" row.

--
Guillaume.
http://www.postgresqlfr.org
http://dalibo.com

In response to

Browse pgadmin-support by date

  From Date Subject
Next Message Guillaume Lelarge 2010-02-08 10:41:57 Re: a quick question
Previous Message Guillaume Lelarge 2010-02-08 10:35:25 Re: how to view TOAST table