Re: ToDo: show size of partitioned table
От | Pavel Stehule |
---|---|
Тема | Re: ToDo: show size of partitioned table |
Дата | |
Msg-id | CAFj8pRDMWPgijpt_vPj1t702PgLG4Ls2NCf+rEcb+qGPpossmg@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: ToDo: show size of partitioned table (Pavel Stehule <pavel.stehule@gmail.com>) |
Ответы |
Re: ToDo: show size of partitioned table
Re: ToDo: show size of partitioned table |
Список | pgsql-hackers |
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)
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)
List of partitioned tables
+--------+------+-------+-------+-------------+
| Schema | Name | Owner | Size | Description |
+--------+------+-------+-------+-------------+
| public | data | pavel | 42 MB | |
+--------+------+-------+-------+-------------+
(1 row)
Regards
Pavel
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)
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"));
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"));
Вложения
В списке pgsql-hackers по дате отправления: