Re: ToDo: show size of partitioned table

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: ToDo: show size of partitioned table
Дата
Msg-id CAFj8pRBo2L0PTWPkfkj-G7BKcickRGCZ9L-VikkU_AhVP4KOKw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: ToDo: show size of partitioned table  (Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>)
Ответы Re: ToDo: show size of partitioned table
Список pgsql-hackers


2018-07-25 11:09 GMT+02:00 Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>:
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.

i think so error messages is different chapter - it means revision of all error messages, and probably somewhere the name of partition, and not partition table can be correct.

Personally I am not sure about benefit to change error messages. Now, the partition is table too, so the error messages are not strongly wrong.

Regards

Pavel



Thanks,
Amit


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Amit Langote
Дата:
Сообщение: Re: ToDo: show size of partitioned table
Следующее
От: Daniel Gustafsson
Дата:
Сообщение: Re: Online enabling of checksums