Re: ToDo: show size of partitioned table - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: ToDo: show size of partitioned table
Date
Msg-id CAFj8pRBujL1LfOps0_3JyowkRObtMEekzVU+KzwLj3F_jyEV5g@mail.gmail.com
Whole thread Raw
In response to Re: ToDo: show size of partitioned table  (Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>)
Responses Re: ToDo: show size of partitioned table  (Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>)
List pgsql-hackers


st 31. 10. 2018 v 3:27 odesílatel Amit Langote <Langote_Amit_f8@lab.ntt.co.jp> napsal:
On 2018/10/30 20:03, Pavel Stehule wrote:
> út 30. 10. 2018 v 7:52 odesílatel Amit Langote <
> Langote_Amit_f8@lab.ntt.co.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.

I though about it too and I prefer separate command. Similar to \di+


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

I am not sure. Has not sense run this test over empty database, and some bigger database can increase running.

More the size can be platform depend.

Regards

Pavel

Thanks,
Amit

pgsql-hackers by date:

Previous
From: Kevin Van
Date:
Subject: WIP Patch: Add a function that returns binary JSONB as a bytea
Next
From: Amit Langote
Date:
Subject: Re: ToDo: show size of partitioned table