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 CAFj8pRC-wWV1VDAvy4deMQjU=PmdA8QSZhx3-Dsd35vDUPtz2g@mail.gmail.com
Whole thread Raw
In response to Re: ToDo: show size of partitioned table  (Michael Paquier <michael@paquier.xyz>)
Responses Re: ToDo: show size of partitioned table
List pgsql-hackers


út 20. 11. 2018 v 8:50 odesílatel Michael Paquier <michael@paquier.xyz> napsal:
On Mon, Nov 05, 2018 at 11:43:16AM +0100, Pavel Stehule wrote:
> should be fixed now.

Here are some notes on the last version.

+   "              FROM pg_inherits i\n"
Missing schema qualification.


fixed
 
+           case 'P':
+               if (cmd[2] == 'i')
+                   success = listPartitions(pattern, show_verbose,
true, false);
+               else if (cmd[2] == 't')
+                   success = listPartitions(pattern, show_verbose,
false, true);
+               else if (cmd[2] == '+' || cmd[2] == '\0')
+                   success = listPartitions(pattern, show_verbose,
false, false);
+               else
+                   status = PSQL_CMD_UNKNOWN;
+               break;
The style is heavy.  Perhaps it would be cleaner to have a
switch/case..  Not a big deal visibly.  show_indexes is true only if the
subcommand is 'i'.  show_tables is true only if the subcommand is 't'.

Using "\dP" with a pattern matching a partitioned index should show a
partitioned index, no?  As far as I know, a partitioned relation can be
either an index or a table.

I don't think

\dP shows uses pg_total_relation_size as size function, and then we should to display just tables, but with total size.

I don't see a sense to show indexes and tables too, more when we show total relation size - see description for total relation size

"total disk space usage for the specified table and associated indexes"
 

Testing the feature, \dP shows all partitioned relations, still does not
show the relationship when multiple levels are used.  Could it make
sense to also show the direct parent of a partitioned table when
verbose mode is used?

it is expected - you got one number for one partitioned table. I agree, so can be interesting to see agregated sizes per partitioning hierarchy - but in this moment I cannot to imagine form of the result.

any table can have different number of levels - so you can get different number of values.
 

Could it be possible to have tests for \dP, \dPi and \dPt with matching
patterns?  You could just place that in one of the existing tests where
there are partitioned tables and indexes.

I did it

see assigned patch, please.

Regards

Pavel

 
--
Michael
Attachment

pgsql-hackers by date:

Previous
From: Andreas Karlsson
Date:
Subject: Re: Need of maintaining unsupported release notes in HEAD?
Next
From: Alvaro Herrera
Date:
Subject: Re: ToDo: show size of partitioned table