Re: ToDo: show size of partitioned table

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Justin Pryzby <pryzby(at)telsasoft(dot)com>, Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>, Michael Paquier <michael(at)paquier(dot)xyz>, mathias(at)brossard(dot)org, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: ToDo: show size of partitioned table
Date: 2019-04-08 17:37:54
Message-ID: 20190408173754.GA9933@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2019-Apr-08, Amit Langote wrote:

> I noticed that the size shown in the output of both \dP+ and \dPt+ does
> include toast relation sizes of (leaf) partitions, because
> pg_table_size(), which is used by all the queries that
> listPartitionedTables sends to the server, does:
>
> /*
> * heap size, including FSM and VM
> */
> for (forkNum = 0; forkNum <= MAX_FORKNUM; forkNum++)
> size += calculate_relation_size(&(rel->rd_node), rel->rd_backend,
> forkNum);
>
> /*
> * Size of toast relation
> */
> if (OidIsValid(rel->rd_rel->reltoastrelid))
> size += calculate_toast_table_size(rel->rd_rel->reltoastrelid);

Sigh. I must have mixed up whether pg_table_size did include toast size
or not. Anyway, I think \dP should report the same thing as \d, which I
think it's doing, so we're good there.

> >> Also, I think the new \dP should gain a new flag (maybe "l") to make it
> >> list leaf tables/indexes too with their local sizes, and remove those
> >> from the standard \d listing.
> >
> > +1
>
> +1 to the idea. Perhaps we'd need to post this in a separate thread to
> highlight what may be a substantive change to \d's output?

Aye aye.

Not in a position to work on that right now; I might get to that in a
few days if nobody beats me to it. (But then, I might not.)

--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2019-04-08 17:41:07 Re: change password_encryption default to scram-sha-256?
Previous Message Andres Freund 2019-04-08 17:37:23 Re: Pluggable Storage - Andres's take