Gurjeet Singh wrote:
> On Tue, Sep 30, 2008 at 6:09 PM, Dimitri Fontaine <dfontaine@hi-media.com>wrote:
>> What's practical about pg_relation_size() and pg_total_relation_size() as
>> of
>> 8.3 is that the diff is the cumulated indexes storage volume. Your proposal
>> makes it harder to get this information, but sounds good otherwise.
>> Would it be possible to add in some new APIs to?
>> a. pg_relation_size()
>> b. pg_relation_fsm_size()
>> c. pg_relation_indexes_size()
>> d. pg_total_relation_size() = a + b + c
>
> You forgot the toast size.
Yeah, pg_total_relation_size() - pg_relation_size() is not equal to the
total size of indexes because of that.
But you can do SUM(pg_relation_size(index)) across all the indexes for that:
SELECT SUM(pg_relation_size(i.oid)) FROM pg_index x JOIN pg_class c ON c.oid = x.indrelid JOIN pg_class i ON
i.oid= x.indexrelid WHERE i.relkind = 'i'::"char" AND c.relname='foo';
-- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com