Re: partition tree inspection functions

Jesper Pedersen <jesper.pedersen@redhat.com>

From: Jesper Pedersen <jesper.pedersen@redhat.com>
To: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>, Robert Haas <robertmhaas@gmail.com>
Cc: Michael Paquier <michael@paquier.xyz>, Jeevan Ladhe <jeevan.ladhe@enterprisedb.com>, Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2018-08-07T12:14:08Z
Lists: pgsql-hackers
Hi,

On 08/07/2018 03:32 AM, Amit Langote wrote:
> Do we need a pg_partition_level that expects the individual partition OID
> to be passed to it or can we do with the information we get from the
> revised pg_partition_children?  In earlier revisions,
> pg_partition_children returned only the partition OIDs, so we needed to
> provide pg_partition_* functions for getting the parent, root parent,
> level, etc. separately.  I mean to ask if is there a need for having these
> functions separately if the revised pg_partition_children already outputs
> that information?
>

I'm thinking of the case where we only have information about a leaf 
partition, and we need its root partition and the actual level in the 
partition tree.

If we had

  SELECT pg_partition_root_parent('leafpart');

and

  SELECT pg_partition_level('leafpart');

-- we don't need the pg_partition_level('leafpart', 'parentpart') 
function now.

We can use pg_partition_children() for the rest.

> pg_partition_leaf_children()'s output can be obtained as follows, after
> adding isleaf column to pg_partition_children's output:
>

Yes, this is great.

Thanks !

Best regards,
  Jesper


Commits

  1. Add pg_partition_tree to display information about partitions