From: | Michael Paquier <michael(dot)paquier(at)gmail(dot)com> |
---|---|
To: | Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp> |
Cc: | Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: [Sender Address Forgery]Re: pg_(total_)relation_size and partitioned tables |
Date: | 2018-01-19 05:39:58 |
Message-ID: | 20180119053958.GD12826@paquier.xyz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, Jan 18, 2018 at 06:54:18PM +0900, Amit Langote wrote:
> I think having pg_partition_root() and pg_partition_parent() will give
> users enough to get useful views as follows:
So... pg_partition_root() gives you access to the highest relation in
the hierarchy, and pg_partition_parent() gives you access to the direct
parent.
> drop table p;
> create table p (a int) partition by list (a);
> create table p123 partition of p for values in (1, 2, 3) partition by list
(a);
> create table p12 partition of p1 for values in (1, 2) partition by list (a);
> create table p12 partition of p123 for values in (1, 2) partition by list (a);
> create table p1 partition of p12 for values in (1);
> create table p2 partition of p12 for values in (2);
> create table p3 partition of p123 for values in (3);
You need to reorder those queries, the creation of the first p12 would
fail as p1 does not exist at this point. Wouldn't also a
pg_partition_tree() be useful? You could shape it as a function which
returns all regclass partitions in the tree as unique entries. Combined
with pg_partition_parent() it can be powerful as it returns NULL for the
partition at the top of the tree. So I think that we could live without
pg_partition_root(). At the end, let's design something which makes
unnecessary the use of WITH RECURSIVE when looking at a full partition
tree to ease the user's life.
Documentation, as well as regression tests, would be welcome :)
--
Michael
From | Date | Subject | |
---|---|---|---|
Next Message | Simon Riggs | 2018-01-19 06:39:19 | Re: Typo in slotfuncs.c |
Previous Message | Masahiko Sawada | 2018-01-19 05:38:01 | Typo in slotfuncs.c |