select actual data size for a relation?

From: Kevin Kempter <kevink(at)consistentstate(dot)com>
To: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: select actual data size for a relation?
Date: 2009-10-22 23:41:38
Message-ID: 200910221741.38657.kevink@consistentstate.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hi all;

Anyone know how to select / calculate the actual data size for a table or
index?

NOT the disk usage as in:
pg_class.relpages -- shows disk usage including bloat
pg_relation_size() -- same as pg_class.relpages but in bytes
or pg_total_relation_size() -- total disk usage inclusive of bloat and
indexes

I want only the data size. I tried grabbing the sum of all the avg_width cols
from pg_stats and multiplying times the pg_class.reltuples but this seems way
too big.

Thoughts?

Thanks in advance

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Joshua D. Drake 2009-10-22 23:56:52 Re: select actual data size for a relation?
Previous Message Yaroslav Tykhiy 2009-10-22 22:35:57 Re: Reversing flow of WAL shipping