Re: pg_(total_)relation_size and partitioned tables - Mailing list pgsql-hackers

From Robert Haas
Subject Re: pg_(total_)relation_size and partitioned tables
Date
Msg-id CA+TgmobG69Nf4E+VKcojXZQa9FRsbr7Dd+NORJRFMh5Umer98w@mail.gmail.com
Whole thread Raw
In response to pg_(total_)relation_size and partitioned tables  (Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>)
Responses Re: pg_(total_)relation_size and partitioned tables
List pgsql-hackers
On Thu, Dec 14, 2017 at 12:23 AM, Amit Langote
<Langote_Amit_f8@lab.ntt.co.jp> wrote:
> You may have guessed from $subject that the two don't work together.

It works exactly as documented:

pg_total_relation_size(regclass) - Total disk space used by the
specified table, including all indexes and TOAST data

It says nothing about including partitions.  If we change this, then
we certainly need to update the documentation (that might be a good
idea if we decide not to update this).

Personally, I'm -1 on including partitions, because then you can no
longer expect that the sum of pg_total_relation_size(regclass) across
all relations in the database will equal the size of the database
itself.  Partitions will be counted a number of times equal to their
depth in the partitioning hierarchy.  However, I understand that I
might get outvoted.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: [HACKERS] Proposal: Local indexes for partitioned table
Next
From: Robert Haas
Date:
Subject: Re: Protect syscache from bloating with negative cache entries