Re: Table size does not include toast size

From: Rafael Martinez <r(dot)m(dot)guerrero(at)usit(dot)uio(dot)no>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Table size does not include toast size
Date: 2009-12-21 15:24:57
Message-ID: 4B2F9349.6070309@usit.uio.no
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Tom Lane wrote:
> Rafael Martinez <r(dot)m(dot)guerrero(at)usit(dot)uio(dot)no> writes:
>> I wonder why the function pg_relation_size(text) does not take into
>> account the space used by toast data in a table when returning the space
>> used by the table.
>
> It's not supposed to. Use pg_total_relation_size if you want a number
> that includes index and toast space.
>

I am probably missing the point here, why is it not supposed to show the
size of the table(data) *without* indexes?

My question was because I can not understand the use and usefulness of
pg_relation_size() (as it works today) in a table that use toast.

- From an administrator point of view, there are two numbers that are
interesting, the total size of a table (indexes included) and the size
of the table without taking into account the space used by its indexes.

At least, if there is a logic in this behavior, it should be documented
in "9.23. System Administration Functions". The documentation only says
"Disk space used by the table or index with ...."

It is not the first time confused users have asked me why
pg_relation_size() does not show the space used by the table without
indexes. Many do not know what 'toast' is, and most probably they do not
need to know about this either.

regards,
- --
Rafael Martinez, <r(dot)m(dot)guerrero(at)usit(dot)uio(dot)no>
Center for Information Technology Services
University of Oslo, Norway

PGP Public Key: http://folk.uio.no/rafael/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.7 (GNU/Linux)

iD8DBQFLL5NCBhuKQurGihQRAmtZAJ99wJPKbS1u2RUGxO4G++X7nbqt2gCeJubn
b+328nrEICsXPS7kgD4bq68=
=bBO8
-----END PGP SIGNATURE-----

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bernd Helmle 2009-12-21 15:25:07 Re: Table size does not include toast size
Previous Message Kevin Grittner 2009-12-21 15:21:46 Re: An example of bugs for Hot Standby