Re: [PATCH] psql: \dn+ to show size of each schema.. - Mailing list pgsql-hackers

From Justin Pryzby
Subject Re: [PATCH] psql: \dn+ to show size of each schema..
Date
Msg-id 20210715190719.GI20208@telsasoft.com
Whole thread Raw
In response to Re: [PATCH] psql: \dn+ to show size of each schema..  (Ian Lawrence Barwick <barwick@gmail.com>)
List pgsql-hackers
On Wed, Jul 14, 2021 at 02:05:29PM +0900, Ian Lawrence Barwick wrote:
> 2021年7月14日(水) 12:07 Justin Pryzby <pryzby@telsasoft.com>:
> >
> > \db+ and \l+ show sizes of tablespaces and databases, so I was surprised in the
> > past that \dn+ didn't show sizes of schemas.  I would find that somewhat
> > convenient, and I assume other people would use it even more useful.
> 
> It's something which would be useful to have. But see this previous proposal:
> 
>    https://www.postgresql.org/message-id/flat/2d6d2ebf-4dbc-4f74-17d8-05461f4782e2%40dalibo.com

Thanks for finding that.

It sounds like the objections were:
1) it may be too slow - I propose the size should be shown only with \n++;
I think \db and \l should get the same treatment, and probably everywhere
should change to use the "int verbose".  I moved the ++ columns to the
right-most column.

2) it may fail or be misleading if user lacks permissions.  
I think Tom's concern was that at some point we might decide to avoid showing a
relation's size to a user who has no access to the rel, and then \dn+ would
show misleading information, or fail.
I implemented this a server-side function for super-user/monitoring role only.  

I think \dn++ is also a reasonable way to address the second concern - if
someone asksk for "very verbose" outpu, they get more of an internal,
implementation dependant output, which might be more likely to change in future
releases.  For example, if we move the ++ columns to the right, someone might
jusifiably think that the \n and \n+ columns would be less likely to change in
the future than the \n++ columns.

I imagine ++ would find more uses in the future.  Like, say, size of an access
methods \dA++.  I'll add that in a future revision - I hope that PG15 will also
have create table like (INCLUDE ACCESS METHOD), ALTER TABLE SET ACCESS METHOD,
and pg_restore --no-tableam.

++ may also allow improved testing of psql features - platform dependent stuff
like size can be in ++, allowing better/easier/testing of +.

-- 
Justin

Attachment

pgsql-hackers by date:

Previous
From: Magnus Hagander
Date:
Subject: Re: Git revision in tarballs
Next
From: "Jonathan S. Katz"
Date:
Subject: Re: unnesting multirange data types