Re: partition tree inspection functions

From: Jesper Pedersen <jesper(dot)pedersen(at)redhat(dot)com>
To: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>, Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Jeevan Ladhe <jeevan(dot)ladhe(at)enterprisedb(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: partition tree inspection functions
Date: 2018-08-03 12:35:55
Message-ID: 7f2e6674-9196-9fe7-1405-368bafd64198@redhat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2018-08-03 12:39:24 Re: [PATCH] Improve geometric types
Previous Message Robert Haas 2018-08-03 12:31:15 Re: Alter index rename concurrently to