Re: [PATCH] psql: \dn+ to show size of each schema (and \dA+ for AMs)

From: David Christensen <david+pg(at)pgguru(dot)net>
To: Justin Pryzby <pryzby(at)telsasoft(dot)com>
Cc: Daniel Gustafsson <daniel(at)yesql(dot)se>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, Ian Lawrence Barwick <barwick(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org, Gilles Darold <gilles(at)darold(dot)net>, Julien Rouhaud <rjuju123(at)gmail(dot)com>, Stefan Fercot <stefan(dot)fercot(at)protonmail(dot)com>, Joseph Koshakow <koshy44(at)gmail(dot)com>
Subject: Re: [PATCH] psql: \dn+ to show size of each schema (and \dA+ for AMs)
Date: 2024-05-30 17:59:06
Message-ID: CAHM0NXgDjp6f-4A5PwKnmmQgVY3-p-yRA5w0c8B0To1rUV6scw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Justin,

Thanks for the patch and the work on it. In reviewing the basic
feature, I think this is something that has utility and is worthwhile
at the high level.

A few more specific notes:

The pg_namespace_size() function can stand on its own, and probably
has some utility for the released Postgres versions.

I do think the psql implementation for the \dn+ or \dA+ commands
shouldn't need to use this same function; it's a straightforward
expansion of the SQL query that can be run in a way that will be
backwards-compatible with any connected postgres version, so no reason
to exclude this information for this cases. (This may have been in an
earlier revision of the patchset; I didn't check everything.)

I think the \dX++ command versions add code complexity without a real
need for it. We have precedence with \l(+) to show permissions on the
basic display and size on the extended display, and I think this is
sufficient in this case here. While moving the permissions to \dn is
a behavior change, it's adding information, not taking it away, and as
an interactive command it is unlikely to introduce significant
breakage in any scripting scenario.

(In reviewing the patch we've also seen a bit of odd behavior/possible
bug with the existing extended + commands, which introducing
significant ++ overloading might be confusing, but not the
fault/concern of this patch.)

Quickie summary:

0001-Add-pg_am_size-pg_namespace_size.patch
- fine, but needs rebase to work
0002-psql-add-convenience-commands-dA-and-dn.patch
- split into just + variant; remove \l++
- make the \dn show permission and \dn+ show size
0003-f-convert-the-other-verbose-to-int-too.patch
- unneeded
0004-Move-the-double-plus-Size-columns-to-the-right.patch
- unneeded

Docs on the first patch seemed fine; I do think we'll need docs
changes for the psql changes.

Best,

David

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alena Rybakina 2024-05-30 18:26:38 Re: Vacuum statistics
Previous Message Alena Rybakina 2024-05-30 17:33:51 Vacuum statistics