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 CAFj8pRBYpDwyLgpA5mon=wE8Dv+BbMWj1BLSQmh7W9QadHYx+w@mail.gmail.com
Whole thread Raw
In response to Re: ToDo: show size of partitioned table  (Justin Pryzby <pryzby@telsasoft.com>)
Responses Re: ToDo: show size of partitioned table
List pgsql-hackers


ne 7. 4. 2019 v 17:27 odesílatel Justin Pryzby <pryzby@telsasoft.com> napsal:
On Sun, Apr 07, 2019 at 08:15:06AM -0400, Alvaro Herrera wrote:
> So how about the attached version?

+1

I found a few issues.

\dP+ didn't work.  Fix attached.

+static const SchemaQuery Query_for_list_of_partitioned_relations = {                                                                             
+       .catname = "pg_catalog.pg_class c",                                                                                                       
+       .selcondition = "c.relkind = " CppAsString2(RELKIND_PARTITIONED_TABLE),                                                                   

=> Should it be called Query_for_list_of_partitioned_tables ?  Or should
c.relkind match indices, too ?

On Sat, Apr 06, 2019 at 01:36:23AM -0300, Alvaro Herrera wrote:
> Maybe the only behavior change I'd do to the submitted patch is to have
> \dP show both tables and indexes, while \dPt shows only tables and \dPi
> shows only indexes.  Maybe have \dPti show both tables and indexes? (
> identical to \dP)  That would be consistent with \d itself.

I think there's an issue with showing indices.  You said that \dP should be
same as \dPti, no?  Right now, indices are not shown in \dP, unless a pattern
is given.  I see you add that behavior in the regression tests; is that really
what's intended ?  Also, right now adding a pattern affects how sizes are
computed, I don't see why that's desirable or, if so, how to resolve that
inconsistency, or how to document it.

That depends. If there are not pattern, then \dP show only tables, but with total relation size (so size of indexes are nested). It is different than \dPti, but I think so it is useful - when you don't specify object type, then usually you would to see a tables, but with total size.

I don't see a benefit from \dP == \dPti. When there are a pattern (that can choose some index, then, indexes are displayed and \dP == \dPti.

I think so Alvaro's version is correct, and I prefer it.

Regards

Pavel


Justin

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Speed up transaction completion faster after many relations areaccessed in a transaction
Next
From: Pavel Stehule
Date:
Subject: Re: ToDo: show size of partitioned table