Re: ToDo: show size of partitioned table - Mailing list pgsql-hackers

From Amit Langote
Subject Re: ToDo: show size of partitioned table
Date
Msg-id ee892049-0fe4-afe6-cbbf-31cf44fa8522@lab.ntt.co.jp
Whole thread Raw
In response to Re: ToDo: show size of partitioned table  (Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>)
Responses Re: ToDo: show size of partitioned table
List 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




pgsql-hackers by date:

Previous
From: Masahiko Sawada
Date:
Subject: Re: New vacuum option to do only freezing
Next
From: Thomas Munro
Date:
Subject: Strange coding in _mdfd_openseg()