Re: ToDo: show size of partitioned table

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
Cc: mathias(at)brossard(dot)org, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: ToDo: show size of partitioned table
Date: 2018-10-30 11:03:49
Message-ID: CAFj8pRBRm9qcK_jo+rZRbiUheuKA6Y1wLcVQytnYoLWT_e2Qog@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox
Thread:
Lists: pgsql-hackers

Hi

út 30. 10. 2018 v 7:52 odesílatel Amit Langote <
Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp> napsal:

> Hi Mathias, Pavel,
>
> On 2018/08/17 12:26, Mathias Brossard wrote:
> > On Thu, Aug 16, 2018 at 12:46 AM Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
> >>
> >> This is question - maybe we can support older partitioning based on only
> >> inheritance - and the query can be more exact on PostgreSQL 10 and
> newer.
> >>
> >> Please, send any patch. You are welcome.
> >
> > In my very humble opinion, I would restrict the definition of partitions
> to
> > declarative partitioning. My justification would be that partitions all
> use
> > inheritance, but not all inheritance is a partition (how would you handle
> > multiple inheritance).
> >
> > See patch attached that fails (in a way similar to other features) when
> > connected to servers with version earlier than 10.0.
>
> The patch to add the pg_partition_tree() function was just committed:
>
> Add pg_partition_tree to display information about partitions
>
> https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=d5eec4eefde70
>
> Could one of you please revise the patch to use that function to produce
> the output of \dP+?
>

here it is.

It is based on Mathias's patch. Although we can use pg_partition_tree on
PostgreSQL, we still should to support PostgreSQL 10, 11 where this
function is not available

Regards

Pavel

> Note that pg_partition_tree simply scans the underlying catalog to get all
> the tables, so if you pass it a table that's not partitioned (relkind ==
> 'r'), but has inheritance children, the children will be returned in its
> output. So, if you want to limit the output of \dP to partitioned tables,
> be sure to include relkind = 'p' condition in the query.
>
> Thanks,
> Amit
>
>

Attachment Content-Type Size
psql-dP-2.patch text/x-patch 8.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Axel Rau 2018-10-30 11:32:08 Re: Getting fancy errors when accessing information_schema on 10.5
Previous Message Andrew Dunstan 2018-10-30 10:49:22 Re: INSTALL file