Re: ToDo: show size of partitioned table

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>, Michael Paquier <michael(at)paquier(dot)xyz>, 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-07 15:03:17
Message-ID: 20190207150317.GA31320@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2019-Feb-07, Pavel Stehule wrote:

> Your example
>
> postgres=# \dPtn+
> List of partitioned tables
> ┌────────┬────────┬───────┬─────────────┬────────────┬─────────────┐
> │ Schema │ Name │ Owner │ Parent name │ Size │ Description │
> ╞════════╪════════╪═══════╪═════════════╪════════════╪═════════════╡
> │ public │ p │ pavel │ │ 8192 bytes │ │
> │ public │ p_1 │ pavel │ p │ 8192 bytes │ │
> │ public │ p_1_bc │ pavel │ p_1 │ 8192 bytes │ │
> └────────┴────────┴───────┴─────────────┴────────────┴─────────────┘
> (3 rows)
>
> I hope so the interpretation is clean .. there are three partitioned tables
> (two are subpartitioned tables). Any partitioned table has assigned 8KB of
> data.
>
> We can introduce new column "size with sub partitions" where these numbers
> can be counted together. But for term "size" I expect valid rule S1+S2+..
> SN = total size.

Right now, a partitioned table has no size of its own; its only storage
is in its children. But that might change in the future, for example if
we implement global indexes. Then it will be useful to show these sizes
separately.

I suggest that we should have one column for the aggregated size of its
children, and another column for the "local" size. So currently the
local size would always be zero for partitioned tables. The other
column (maybe "Children Size") would be the sum of the sizes of all its
partitions.

So I think this should be:

List of partitioned tables
┌────────┬────────┬───────┬─────────────┬────────────┬───────────────┬────────────
│ Schema │ Name │ Owner │ Parent name │ Size │ Children Size │ Description
╞════════╪════════╪═══════╪═════════════╪════════════╪═══════════════╡
│ public │ p │ pavel │ │ │ 8192 bytes │
│ public │ p_1 │ pavel │ p │ │ 8192 bytes │
│ public │ p_1_bc │ pavel │ p_1 │ 8192 bytes │ │
└────────┴────────┴───────┴─────────────┴────────────┴───────────────┴─────────────

--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2019-02-07 15:07:01 Re: [HACKERS] REINDEX CONCURRENTLY 2.0
Previous Message Tom Lane 2019-02-07 14:49:05 Re: phase out ossp-uuid?