select actual data size for a relation? - Mailing list pgsql-admin

From Kevin Kempter
Subject select actual data size for a relation?
Date
Msg-id 200910221741.38657.kevink@consistentstate.com
Whole thread Raw
Responses Re: select actual data size for a relation?  ("Joshua D. Drake" <jd@commandprompt.com>)
Re: select actual data size for a relation?  ("Joshua D. Drake" <jd@commandprompt.com>)
List 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

pgsql-admin by date:

Previous
From: "Eric Comeau"
Date:
Subject: Increasing the length of a VARCHAR column without table rewrite
Next
From: "Joshua D. Drake"
Date:
Subject: Re: Fwd: Reversing flow of WAL shipping