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: 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-10-31 02:26:59
Message-ID: 1c83bb5c-47cd-d796-226c-e95795b05551@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2018/10/30 20:03, Pavel Stehule wrote:
> út 30. 10. 2018 v 7:52 odesílatel Amit Langote <
> Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp> napsal:
>> Could one of you please revise the patch to use that function to produce
>> the output of \dP+?
>>
>
> here it is.
>
> It is based on Mathias's patch. Although we can use pg_partition_tree on
> PostgreSQL, we still should to support PostgreSQL 10, 11 where this
> function is not available

Thanks for updating the patch. Just a couple of comments:

+ is used, a sum of size of related partitions and a description

I suggest:

is used, the sum of sizes of related partitions and associated description

+ 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.

+ if (PQntuples(res) == 0 && !pset.quiet)
+ {
+ if (pattern)
+ psql_error("Did not find any relation named \"%s\".\n",
+ pattern);
+ else
+ psql_error("Did not find any relations.\n");
+ }

I think we should use "partitioned table" instead of "relation" in the
above error messages, because this command is specifically finding
partitioned tables.

(If we decide to include partitioned indexes as well, then the above error
message should say "partitioned relation")

+ fprintf(output, _(" \\dP[+] [PATTERN] list partitioned
tables\n"));

Again, if we include indexes, this should be "partitioned relations".

How about adding a couple of regression tests?

Thanks,
Amit

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2018-10-31 03:32:37 Re: Super PathKeys (Allowing sort order through precision loss functions)
Previous Message Michael Paquier 2018-10-31 02:10:23 Re: replication_slots usability issue