Re: ToDo: show size of partitioned table - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: ToDo: show size of partitioned table
Date
Msg-id 20190207150317.GA31320@alvherre.pgsql
Whole thread Raw
In response to Re: ToDo: show size of partitioned table  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: ToDo: show size of partitioned table
List 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


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: phase out ossp-uuid?
Next
From: Alvaro Herrera
Date:
Subject: Re: [HACKERS] REINDEX CONCURRENTLY 2.0