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-03T12:35:55Z
Lists: pgsql-hackers
Hi Amit,

On 08/03/2018 04:28 AM, Amit Langote wrote:
> That's a good idea, thanks.
> 
> Actually, by the time I sent the last version of the patch or maybe few
> versions before that, I too had started thinking if we shouldn't just have
> a SETOF RECORD function like you've outlined here, but wasn't sure of the
> fields it should have.  (relid, parentid, level) seems like a good start,
> or maybe that's just what we need.
> 

I think there should be a column that identifies leaf partitions (bool 
isleaf), otherwise it isn't obvious in complex scenarios.

> 
> Note that the level that's returned for each table is computed wrt the
> root table passed to the function and not the actual root partition.
> 

If you are given a leaf partition as input, then you will have to keep 
executing the query until you find the root, and count those. So, I 
think it should be either be the level to the root, or there should be 
another column that lists that (rootlevel).

Best regards,
  Jesper


Commits

  1. Add pg_partition_tree to display information about partitions