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.
Yeah.
>>>> 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.
Thanks,
Amit