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: Michael Paquier <michael(at)paquier(dot)xyz>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, mathias(at)brossard(dot)org, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: ToDo: show size of partitioned table
Date: 2019-02-16 21:52:35
Message-ID: CAFj8pRDwtY+caxSTec1KM4ej0PH0-BDDgT9AK8hB35OQews4Dw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

pá 15. 2. 2019 v 7:50 odesílatel Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
napsal:

> Hi Pavel,
>
> Thanks for updating the patch.
>
> On 2019/02/08 17:26, Pavel Stehule wrote:
> > I renamed originally calculated column "size" to "direct partitions size"
> > .. see Alvaro's comment. Then I introduced new column "total partitions
> > size" that is calculated like you propose.
> >
> > Now the result of dPn+ looks like
> >
> > List of partitioned relations
> >
> ┌────────┬────────┬───────┬─────────────┬────────────────────────┬───────────────────────┬─────────────┐
> > │ Schema │ Name │ Owner │ Parent name │ Direct partitions size │ Total
> > partitions size │ Description │
> >
> ╞════════╪════════╪═══════╪═════════════╪════════════════════════╪═══════════════════════╪═════════════╡
> > │ public │ p │ pavel │ │ 8192 bytes │ 24
> > kB │ │
> > │ public │ p_1 │ pavel │ p │ 8192 bytes │ 16
> > kB │ │
> > │ public │ p_1_bc │ pavel │ p_1 │ 8192 bytes │ 8192
> > bytes │ │
> >
> └────────┴────────┴───────┴─────────────┴────────────────────────┴───────────────────────┴─────────────┘
> > (3 rows)
>
> OK, so for each listed partitioned table (root and nested), this shows the
> total size of the directly attached leaf partitions *and* the total size
> of all partitions in its (sub-) tree.
>
> By the way, what I think Alvaro meant by "local size" is not what the
> "direct partition size" above shows. I think "local size" means the size
> of the storage assigned to the table itself, not to partitions attached to
> it, which are distinct relations. We don't implement that concept in
> Postgres today, but may in the future. I'm not sure if we'll add a
> another column to show "local size" in the future when we do implement
> that concept or if Alvaro meant that there should only be "local size"
> (not "direct partition size") which will always show 0 for now and "total
> partition size" columns.
>

We can do it in future. Now, I don't think so is good to show 0 always. The
psql reports (like this) can be enhanced or changed in future without
problems, so we don't need to design all now.

>
> Anyway, I have a few more suggestions to improve the patch, but instead of
> sending the minute-level changes in the email, I've gone ahead and made
> those changes myself. I've attached a delta patch that applies on top of
> your v9 patch. Summary of the changes I made is as follows:
>
> * Documentation rewording here and there (also mentioned the "direct
> partitions size" and "total partitions size" division in the \dPn output
> per the latest patch)
>
> * Wrapped some lines in code so that they don't look too wide
>
> * Renamed show_nested_partitions to show_nested
>
> * Changed "Partitioned relations" in the output headers to say
> "Partitioned tables" where appropriate
>
> * Fixed quiet mode output to use correct word between object_name vs
> objects_name
>
> Please merge these changes if you think they are reasonable.
>

I like your changes. I merged all - updated patch is attached

Thank you very much

Regards

Pavel

> Thanks,
> Amit
>

Attachment Content-Type Size
psql-dP-10.patch text/x-patch 24.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Janes 2019-02-16 22:07:44 Re: TupleTableSlot abstraction
Previous Message Noah Misch 2019-02-16 21:40:23 Re: Synchronize with imath upstream