Re: ToDo: show size of partitioned table

From: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
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-09 06:25:15
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 2019/04/09 2:37, Alvaro Herrera wrote:
> 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.)

Sure. I guess I also wanted to hear if you were of thinking it as PG 12
material or PG 13.


In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2019-04-09 06:32:17 Re: Status of the table access method work
Previous Message Iwata, Aya 2019-04-09 06:19:32 RE: libpq debug log