Re: ToDo: show size of partitioned table

From: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
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-07-25 09:09:05
Message-ID: 5474c8b6-04e7-1afc-97b6-adb7471c2c71@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Pavel.

On 2018/07/23 20:46, Pavel Stehule wrote:
> Hi
>
> I am sending a prototype of patch. Now, it calculates size of partitioned
> tables with recursive query. When any more simple method will be possible,
> the size calculation will be changed.
>
> postgres=# \dt+
> List of relations
> +--------+------------+-------+-------+---------+-------------+
> | Schema | Name | Type | Owner | Size | Description |
> +--------+------------+-------+-------+---------+-------------+
> | public | data | table | pavel | 0 bytes | |
> | public | data_2016 | table | pavel | 15 MB | |
> | public | data_2017 | table | pavel | 15 MB | |
> | public | data_other | table | pavel | 11 MB | |
> +--------+------------+-------+-------+---------+-------------+
> (4 rows)
>
> postgres=# \dP+
> List of partitioned tables
> +--------+------+-------+-------+-------------+
> | Schema | Name | Owner | Size | Description |
> +--------+------+-------+-------+-------------+
> | public | data | pavel | 42 MB | |
> +--------+------+-------+-------+-------------+
> (1 row)

This looks nice, although I haven't looked at the patch yet. Also, as you
said, we could later replace the method of directly querying pg_inherits
by something else.

> p.s. Another patch can be replacement of relation type from "table" to
> "partitioned table"
>
> postgres=# \dt+
> List of relations
> +--------+------------+-------------------+-------+---------+-------------+
> | Schema | Name | Type | Owner | Size | Description |
> +--------+------------+-------------------+-------+---------+-------------+
> | public | data | partitioned table | pavel | 0 bytes | |
> | public | data_2016 | table | pavel | 15 MB | |
> | public | data_2017 | table | pavel | 15 MB | |
> | public | data_other | table | pavel | 11 MB | |
> +--------+------------+-------------------+-------+---------+-------------+
> (4 rows)
>
> A patch is simple for this case
>
> diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
> index c3bdf8555d..491e58eb29 100644
> --- a/src/bin/psql/describe.c
> +++ b/src/bin/psql/describe.c
> @@ -3490,8 +3490,8 @@ listTables(const char *tabtypes, const char *pattern,
> bool verbose, bool showSys
> gettext_noop("sequence"),
> gettext_noop("special"),
> gettext_noop("foreign table"),
> - gettext_noop("table"), /* partitioned table */
> - gettext_noop("index"), /* partitioned index */
> + gettext_noop("partitioned table"), /* partitioned
> table */
> + gettext_noop("partitioned index"), /* partitioned
> index */
> gettext_noop("Type"),
> gettext_noop("Owner"));

Inclined to +1 this, too. Although, one might ask why partitioned tables
are called so only in the psql's output, but not in the backend's error
messages, for example, as was discussed in the past.

Thanks,
Amit

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2018-07-25 09:18:44 Re: ToDo: show size of partitioned table
Previous Message Amit Langote 2018-07-25 08:28:11 Re: Internal error XX000 with enable_partition_pruning=on, pg 11 beta1 on Debian