Re: ToDo: show size of partitioned table

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>, 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-11-21 16:09:39
Message-ID: CAFj8pRC-wWV1VDAvy4deMQjU=PmdA8QSZhx3-Dsd35vDUPtz2g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox
Thread:
Lists: pgsql-hackers

út 20. 11. 2018 v 8:50 odesílatel Michael Paquier <michael(at)paquier(dot)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 Content-Type Size
psql-dP-5.patch text/x-patch 16.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2018-11-21 16:21:36 Re: ToDo: show size of partitioned table
Previous Message Andreas Karlsson 2018-11-21 15:40:27 Re: Need of maintaining unsupported release notes in HEAD?