Thread: Re: [PATCHES] Dbsize backend integration

Re: [PATCHES] Dbsize backend integration

From
"Dave Page"
Date:

> -----Original Message-----
> From: Michael Glaesemann [mailto:grzm@myrealbox.com]
> Sent: 30 June 2005 10:01
> To: Dave Page
> Cc: PostgreSQL-patches; PostgreSQL-development
> Subject: Re: [PATCHES] Dbsize backend integration
>
>
> I'm still unclear as to what exactly is trying to be captured by the
> names, so I'll just throw some out and see if they're intuitive to
> anyone.

Thanks Michael. We have 2 functions - 1 returns the on disk size of a
table or index without any additional parts such as indexes or toast
tables. The other function returns the total on disk size of a table and
all associated indexes and toast tables (and any indexes they might
have). The current names are pg_relation_size() for the first function,
and pg_table_size() for the second.

> pg_table_extensions_size()
> pg_table_support_size()
> pg_relation_extensions_size()
> pg_relation_support_size()
>
> pg_relation_extended_size()

Hmm, none of those really stand out - but thanks anyway. More are
welcome :-)

Regards, Dave

Re: [PATCHES] Dbsize backend integration

From
Tom Lane
Date:
"Dave Page" <dpage@vale-housing.co.uk> writes:
> Thanks Michael. We have 2 functions - 1 returns the on disk size of a
> table or index without any additional parts such as indexes or toast
> tables. The other function returns the total on disk size of a table and
> all associated indexes and toast tables (and any indexes they might
> have). The current names are pg_relation_size() for the first function,
> and pg_table_size() for the second.

That seems to me to work perfectly fine.  "Relation" is being used here
in its PG-jargon sense, that is an object described by one row of
pg_class, and "table" is being used from the user's point of view.

Or at least sort of --- I think most users know enough to distinguish
tables and indexes.  We can figure that the toast table and its index
ought to be considered part of the "base" table, though, since the
user doesn't have a choice about those.

I've not been following the thread closely, so maybe this was already
proposed and rejected, but what about:

    pg_relation_size: size of exactly the relation you point it at
            (table, index, toast table, whatever)

    pg_table_size: point it at heap, get size of heap+toast+toast_index

    pg_index_size: point it at heap, get size of all indexes for heap
            (excludes toast index)

    pg_total_size: point it at heap, get table_size + index_size

            regards, tom lane