Re: Extended Statistics set/restore/clear functions.

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
Cc: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, Tender Wang <tndrwang(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Extended Statistics set/restore/clear functions.
Date: 2026-01-27 23:51:54
Message-ID: aXlPml6eaoU8lM5f@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jan 27, 2026 at 11:14:12AM -0500, Corey Huinker wrote:
>> 0001 - adds a test left out of dependencies

Applied this one now, you are right that it should have been added in
302879bd68d1, so my mistake I guess.

> Before I forget, one thing that I did find notable is that the
> mcv/expressions type importing code bypasses statatt_get_type() now, which
> means that there is only one caller for this function, and it could be
> moved back to being static.

Indeed, I can see that. I don't feel a strong need in moving it back
to statatt_get_type(), HEAD or the previous states feel fine to me
either way.

> Furthermore statatt_get_type() only exists because the two varietals of
> examine_attribute() are just slightly off what we need - the one in
> analyze.c will skip attributes with a target set to 0, and the one in
> extended_stats.c only handles expressions. So there might be some
> consolidation possible, but we'd have to change the code already being run
> for regular ANALYZE and up til now that's been something I haven't wanted
> to do.

The second flavor of examine_attribute() for extended stats is an
older artifact of v14, while get_attr_stat_type() (aka
statatt_get_type() on HEAD) is new to v18. More consolidation of all
this code seems like it could be an interesting move with the
long-term picture in mind. The code added to extended_stats.c in v14
is clearly a simplified copy-paste of what existed in analyze.c. I
don't see a strong need to do that on this thread for the moment,
let's first focus on finishing this project :)
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mihail Nikalayeu 2026-01-28 00:45:00 Re: Issues with ON CONFLICT UPDATE and REINDEX CONCURRENTLY
Previous Message Melanie Plageman 2026-01-27 22:58:33 Re: eliminate xl_heap_visible to reduce WAL (and eventually set VM on-access)