Re: Statistics Import and Export

From: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, jian he <jian(dot)universality(at)gmail(dot)com>, Nathan Bossart <nathandbossart(at)gmail(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Magnus Hagander <magnus(at)hagander(dot)net>, Stephen Frost <sfrost(at)snowman(dot)net>, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, alvherre(at)alvh(dot)no-ip(dot)org, Noah Misch <noah(at)leadboat(dot)com>
Subject: Re: Statistics Import and Export
Date: 2025-01-21 06:43:17
Message-ID: CADkLM=fh_ts+4GZgE9XGYQH9i3Ht7zr22uB1F0S969-gMC9x9Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jan 20, 2025 at 10:59 PM Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
wrote:

> Are you saying that there is a path for a partitioned index to have
>> stats today? If so, we can just follow that locking protocol. If not,
>> I'm concerned about trying to define the locking protocol for doing so
>> as a side-effect of this work.
>>
>
> A quick test on v17 indicates that, no, there is no path for a partitioned
> index to have stats of its own, so I'm fine with removing
> RELKIND_PARTITIONED_INDEX from the allowable relkinds. The partitions of
> the partitioned index have stats but the umbrella index does not.
>
>
>> Wouldn't it be easy enough to issue a WARNING and skip it?
>>
>
> Sure.
>
>

So this is the next iteration - it rejects setting stats on partitioned
indexes entirely, and it does all the ACL checks against the underlying
relation instead of the indexrel. The only oddity is that if a user calls a
statistics setting function on some_index of some_table, and they do not
have permission to modify stats on some_table, the error message they get
reflects the lack of permission on some_table, not the some_index that was
invoked. That may be initially surprising, but it actually is more helpful
because the permissions that need to change are on the table not the index.

Attachment Content-Type Size
v41-0001-Lock-table-first-when-setting-index-relation-sta.patch text/x-patch 6.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hayato Kuroda (Fujitsu) 2025-01-21 07:03:05 pgbench without dbname worked differently with psql and pg_dump
Previous Message Michael Paquier 2025-01-21 06:39:51 Re: pg_createsubscriber TAP test wrapping makes command options hard to read.