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-11-03 19:58:56
Message-ID: CAFj8pRDE73OJZjxNv9Wf5iQRxDKQ5Ph9B2pGV+=PVAm65EgEXA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

pá 2. 11. 2018 v 6:17 odesílatel Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
napsal:

> Hi,
>
> On 2018/11/01 2:19, Pavel Stehule wrote:
> > st 31. 10. 2018 v 7:34 odesílatel Amit Langote <
> > Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp> napsal:
> >> On 2018/10/31 15:30, Pavel Stehule wrote:
> >>> st 31. 10. 2018 v 3:27 odesílatel Amit Langote <
> >>> Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp> napsal:
> >>>> + appendPQExpBufferStr(&buf, "\nWHERE c.relkind IN ('p')\n");
> >>>>
> >>>> I wonder if we should list partitioned indexes ('I') as well, because
> >>>> their size information is not available with \di+. But maybe, they
> >> should
> >>>> have a separate command.
> >>>>
> >>>
> >>> I though about it too and I prefer separate command. Similar to \di+
> >>
> >> Okay, maybe \dI+.
> >>
> >>
> > what about combination
> >
> > \dPt+ for partitined tables and size
> > \dPi+ for indexes on partitioned tables and size
> > \dP+ for total partition size (tables + indexes)
>
> +1
>

here is a patch

postgres=# \dt+
List of relations
┌────────┬───────────┬───────┬───────┬─────────┬─────────────┐
│ Schema │ Name │ Type │ Owner │ Size │ Description │
╞════════╪═══════════╪═══════╪═══════╪═════════╪═════════════╡
│ public │ data │ table │ pavel │ 0 bytes │ │
│ public │ data_2016 │ table │ pavel │ 18 MB │ │
│ public │ data_2017 │ table │ pavel │ 17 MB │ │
└────────┴───────────┴───────┴───────┴─────────┴─────────────┘
(3 rows)

postgres=# \di+
List of relations
┌────────┬────────────────────────┬───────┬───────┬───────────┬─────────┬─────────────┐
│ Schema │ Name │ Type │ Owner │ Table │ Size │
Description │
╞════════╪════════════════════════╪═══════╪═══════╪═══════════╪═════════╪═════════════╡
│ public │ data_2016_inserted_idx │ index │ pavel │ data_2016 │ 11 MB
│ │
│ public │ data_2016_value_idx │ index │ pavel │ data_2016 │ 15 MB
│ │
│ public │ data_2017_inserted_idx │ index │ pavel │ data_2017 │ 10 MB
│ │
│ public │ data_2017_value_idx │ index │ pavel │ data_2017 │ 14 MB
│ │
│ public │ data_inserted_idx │ index │ pavel │ data │ 0 bytes
│ │
│ public │ data_value_idx │ index │ pavel │ data │ 0 bytes
│ │
└────────┴────────────────────────┴───────┴───────┴───────────┴─────────┴─────────────┘
(6 rows)

postgres=# \dP+
List of partitioned relations
┌────────┬──────┬───────┬───────┬─────────────┐
│ Schema │ Name │ Owner │ Size │ Description │
╞════════╪══════╪═══════╪═══════╪═════════════╡
│ public │ data │ pavel │ 84 MB │ │
└────────┴──────┴───────┴───────┴─────────────┘
(1 row)

postgres=# \dPt+
List of partitioned tables
┌────────┬──────┬───────┬───────┬─────────────┐
│ Schema │ Name │ Owner │ Size │ Description │
╞════════╪══════╪═══════╪═══════╪═════════════╡
│ public │ data │ pavel │ 35 MB │ │
└────────┴──────┴───────┴───────┴─────────────┘
(1 row)

postgres=# \dPi+
List of partitioned indexes
┌────────┬───────────────────┬───────┬───────┬───────┬─────────────┐
│ Schema │ Name │ Owner │ Table │ Size │ Description │
╞════════╪═══════════════════╪═══════╪═══════╪═══════╪═════════════╡
│ public │ data_inserted_idx │ pavel │ data │ 21 MB │ │
│ public │ data_value_idx │ pavel │ data │ 28 MB │ │
└────────┴───────────────────┴───────┴───────┴───────┴─────────────┘
(2 rows)

> Thanks,
> Amit
>
>

Attachment Content-Type Size
psql-dP-3.patch text/x-patch 13.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ron 2018-11-03 20:06:02 Re: backend crash on DELETE, reproducible locally
Previous Message Tom Lane 2018-11-03 19:38:14 Re: backend crash on DELETE, reproducible locally