Re: list of extended statistics on psql - Mailing list pgsql-hackers

From Tomas Vondra
Subject Re: list of extended statistics on psql
Date
Msg-id a9c2eb3f-a4e7-b196-9a87-f2acfb5c4859@enterprisedb.com
Whole thread Raw
In response to Re: list of extended statistics on psql  (Tomas Vondra <tomas.vondra@enterprisedb.com>)
Responses Re: list of extended statistics on psql  (Justin Pryzby <pryzby@telsasoft.com>)
Re: list of extended statistics on psql  (Tatsuro Yamada <tatsuro.yamada.tf@nttcom.co.jp>)
List 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



pgsql-hackers by date:

Previous
From: Magnus Hagander
Date:
Subject: Re: WIP: document the hook system
Next
From: Magnus Hagander
Date:
Subject: Re: Online checksums patch - once again