Re: [BUG?] estimate_hash_bucket_stats uses wrong ndistinct for avgfreq - Mailing list pgsql-hackers

From Joel Jacobson
Subject Re: [BUG?] estimate_hash_bucket_stats uses wrong ndistinct for avgfreq
Date
Msg-id 03355ac5-0e80-4bbf-ba90-b655226a00a2@app.fastmail.com
Whole thread Raw
In response to Re: [BUG?] estimate_hash_bucket_stats uses wrong ndistinct for avgfreq  (Tender Wang <tndrwang@gmail.com>)
List pgsql-hackers
On Thu, Feb 26, 2026, at 14:56, Tender Wang wrote:
> I think your analysis is correct.
> After bd3e3e9, the mcv_freq is calculated by RelOptInfo.rows, which
> accounts for restriction clauses.
> But avgfreq is for the raw relation.
...
> So I agree with your fix.
> I added Tom to the cc list. He may know more about this.

Many thanks for testing and reviewing.

Here is the commitfest entry, if you want to register as Reviewer
and/or think it's Ready for Committer:

https://commitfest.postgresql.org/patch/6528/

/Joel



pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: index prefetching
Next
From: Fujii Masao
Date:
Subject: Release postmaster working memory context in slotsync worker