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: Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: ToDo: show size of partitioned table
Date: 2018-06-20 08:25:37
Message-ID: CAFj8pRC8-yMmoQ6WueDK2Bp=WbHWFbjkdJOgFZZ9dSxkr1-RLw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2018-06-20 10:03 GMT+02:00 Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>:

> On 2018/06/20 16:50, Pavel Stehule wrote:
> > 2018-06-20 9:44 GMT+02:00 Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>:
> >> Do you mean \dt continues to show size 0 for partitioned tables, but
> with
> >> the new option (\dtP+) shows the actual size by aggregating across
> >> partitions? +1 to such a feature, but we need to agree on an acceptable
> >> implementation for that. How does the aggregation happen:
> >>
> >
> > yes - my proposal is no change for \dt for now. I think so we will have
> to
> > change it, when partitioning will be more common and number of partitions
> > will be high. But it is not today.
> >
> > \dtP shows only partitions tables (like \dtS shows only system tables),
> > with "+" shows sum of all related partitions.
>
> Ah, okay. That makes sense.
>
> >> 1. In a new dedicated function in the backend (parallel to
> pg_table_size)?
> >>
> >> or
> >>
> >> 2. psql issues a separate query to compute the total size of a partition
> >> tree
> >>
> >
> > In this moment we can simply do sum on client side, so it is related to
> @2.
>
> I see, okay.
>
> >> For option 2, I had posted a patch that simplifies writing such a query
> >> and posted that here:
> >>
> >> https://www.postgresql.org/message-id/7a9c5328-5328-52a3-
> >> 2a3d-bf1434b4dd1d%40lab.ntt.co.jp
> >>
> >> With that patch, the query to get the total size of a partition tree
> >> becomes as simple as:
> >>
> >> select sum(pg_table_size(p)) as size
> >> from pg_get_inheritance_tables('partitioned_table_name') p
> >>
> >
> > good to know it. Thank you. Do you think so your patch should be included
> > to this feature or will be processed independently?
>
> It seems that it would be useful on its own, as people may want to do
> various things once we provide them pg_get_inheritance_table.
>

ok

I'll prepare patch and I'll do note about dependency on your patch.

Regards

Pavel

> Thanks,
> Amit
>
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2018-06-20 08:51:23 Re: server crashed with TRAP: FailedAssertion("!(!parallel_aware || pathnode->path.parallel_safe)"
Previous Message Amit Langote 2018-06-20 08:03:46 Re: ToDo: show size of partitioned table