Re: ToDo: show size of partitioned table

From: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
To: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>, alvherre(at)2ndquadrant(dot)com
Cc: pavel(dot)stehule(at)gmail(dot)com, pryzby(at)telsasoft(dot)com, michael(at)paquier(dot)xyz, mathias(at)brossard(dot)org, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: ToDo: show size of partitioned table
Date: 2019-04-03 03:55:06
Message-ID: ee892049-0fe4-afe6-cbbf-31cf44fa8522@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Horiguchi-san,

Thanks for taking a look.

On 2019/04/03 12:02, Kyotaro HORIGUCHI wrote:
> \dPn doesn't show children because the are of 'r' relkind. And
> \dPn * doesn't show type for children.
>
> create table pa (a int, b int) partition by range (a);
> create table c1 partition of pa for values from (0) to (10);
> create table c2 partition of pa for values from (10) to (20);
> create index on pa(a);
>
> postgres=# \dPn *
> List of partitioned tables and indexes
> Schema | Name | Owner | Type | Parent name | On table
> --------+----------+----------+-------------------+-------------+----------
> public | pa | horiguti | partitioned table | |
> public | pa_a_idx | horiguti | partitioned index | | pa
> (2 rows)
>
>
> With the attached on top of the latest patch, we get the following result.
>
> postgres=# \dPn *
> List of partitioned tables and indexes
> Schema | Name | Owner | Type | Parent name | On table
> --------+----------+----------+-------------------+-------------+----------
> public | c1 | horiguti | partition table | pa |
> public | c1_a_idx | horiguti | partition index | pa_a_idx | c1
> public | c2 | horiguti | partition table | pa |
> public | c2_a_idx | horiguti | partition index | pa_a_idx | c2
> public | pa | horiguti | partitioned table | |
> public | pa_a_idx | horiguti | partitioned index | | pa
> (6 rows)

I think it's intentional that leaf partitions are not shown, because the
patch is meant to allow showing only the "partitioned" members of
partition trees. Regular \d[t|i][+] shows normal tables ('r', 'i', etc.)
including their size, but it's useless for partitioned tables ('P', 'I',
etc.) as far as showing the size is concerned, so the patch. Even \dPn is
meant to only show partitions that are themselves partitioned; note the
"P" in the command.

Thanks,
Amit

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2019-04-03 04:14:36 Strange coding in _mdfd_openseg()
Previous Message Masahiko Sawada 2019-04-03 03:10:03 Re: New vacuum option to do only freezing