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

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Justin Pryzby <pryzby(at)telsasoft(dot)com>
Cc: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, Ian Lawrence Barwick <barwick(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Gilles Darold <gilles(at)darold(dot)net>
Subject: Re: [PATCH] psql: \dn+ to show size of each schema (and \dA+ for AMs)
Date: 2021-09-28 04:33:58
Message-ID: CAFj8pRBHO9Q9jxiWvTsD5-Z+xgPxjtjFFtyaNaA883bF3XgPwA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

út 28. 9. 2021 v 4:46 odesílatel Justin Pryzby <pryzby(at)telsasoft(dot)com>
napsal:

> On Fri, Sep 17, 2021 at 12:05:04PM +0200, Pavel Stehule wrote:
> > I can live with the proposed patch, and I understand why ++ was
> > introduced. But I am still not sure it is really user friendly. I prefer
> to
> > extend \dA and \dn with some columns (\dA has only two columns and \dn
> has
> > two columns too), and then we don't need special ++ variants for sizes.
> > Using three levels of detail looks not too practical (more when the basic
> > reports \dA and \dn) are really very simple).
>
> You're suggesting to include the ACL+description in \dn and
> handler+description
> and \dA.
>

yes

> Another option is to add pg_schema_size() and pg_am_size() without
> shortcuts in
> psql. That would avoid showing a potentially huge ACL when all one wants
> is
> the schema size, and would serve my purposes well enough to write
> | SELECT pg_namespace_size(oid), nspname FROM pg_namespace ORDER BY 1 DESC
> LIMIT 9;
>

It can work too.

I think the long ACL is a customer design issue, but can be. But the same
problem is in \dt+, and I don't see an objection against this design.

Maybe I am too subjective, because 4 years I use pspg, and wide reports are
not a problem for me. When the size is on the end, then it is easy to see
it in pspg.

I like to see size in \dn+ report, and I like to use pg_namespace_size
separately too. Both can be very practical functionality.

I think so \dt+ and \l+ is working very well now, and I am not too happy to
break it (partially break it). Although the proposed change is very
minimalistic.

But your example "SELECT pg_namespace_size(oid), nspname FROM pg_namespace
ORDER BY 1 DESC LIMIT 9" navigates me to the second idea (that just
enhances the previous). Can be nice if you can have prepared views on the
server side that are +/- equivalent to psql reports, and anybody can simply
write their own custom reports.

some like

SELECT schema, tablename, owner, pg_size_pretty(size) FROM
pg_description.tables ORDER BY size DESC LIMIT 10
SELECT schema, owner, pg_size_pretty(size) FROM pg_description.schemas
ORDER BY size DESC LIMIT 10

In the future, it can simplify psql code, and it allows pretty nice
customization in any client for a lot of purposes.

Regards

Pavel

> --
> Justin
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2021-09-28 04:50:29 Re: POC: Cleaning up orphaned files using undo logs
Previous Message Drouvot, Bertrand 2021-09-28 04:24:42 Re: [BUG] failed assertion in EnsurePortalSnapshotExists()