Re: list of extended statistics on psql

From: Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>
To: "Shinoda, Noriyoshi (PN Japan FSIP)" <noriyoshi(dot)shinoda(at)hpe(dot)com>, Julien Rouhaud <rjuju123(at)gmail(dot)com>, Tatsuro Yamada <tatsuro(dot)yamada(dot)tf(at)nttcom(dot)co(dot)jp>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: list of extended statistics on psql
Date: 2021-01-17 14:31:57
Message-ID: a9c2eb3f-a4e7-b196-9a87-f2acfb5c4859@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 1/17/21 3:01 AM, Tomas Vondra wrote:
> On 1/17/21 2:41 AM, Shinoda, Noriyoshi (PN Japan FSIP) wrote:
>> Hi, hackers.
>>
>> I tested this committed feature.
>> It doesn't seem to be available to non-superusers due to the inability
>> to access pg_statistics_ext_data.
>> Is this the expected behavior?
>>
>
> Hmmm, that's a good point. Bummer we haven't noticed that earlier.
>
> I wonder what the right fix should be - presumably we could do something
> like pg_stats_ext (we can't use that view directly, because it formats
> the data, so the sizes are different).
>
> But should it list just the stats the user has access to, or should it
> list everything and leave the inaccessible fields NULL?
>

I've reverted the commit - once we find the right way to handle this,
I'll get it committed again.

As for how to deal with this, I can think of about three ways:

1) simplify the command to only print information from pg_statistic_ext
(so on information about which stats are built or sizes)

2) extend pg_stats_ext with necessary information (e.g. sizes)

3) create a new system view, with necessary information (so that
pg_stats_ext does not need to be modified)

4) add functions returning the necessary information, possibly only for
statistics the user can access (similarly to what pg_stats_ext does)

Options 2-4 have the obvious disadvantage that this won't work on older
releases (we can't add views or functions there). So I'm leaning towards
#1 even if that means we have to remove some of the details. We can
consider adding that for new releases, though.

regards

--
Tomas Vondra
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2021-01-17 14:35:26 Re: Online checksums patch - once again
Previous Message Magnus Hagander 2021-01-17 13:53:10 Re: WIP: document the hook system