Re: [BUG?] estimate_hash_bucket_stats uses wrong ndistinct for avgfreq

From: "Joel Jacobson" <joel(at)compiler(dot)org>
To: "Tender Wang" <tndrwang(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: [BUG?] estimate_hash_bucket_stats uses wrong ndistinct for avgfreq
Date: 2026-02-27 15:54:10
Message-ID: 03355ac5-0e80-4bbf-ba90-b655226a00a2@app.fastmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2026-02-27 16:25:12 Release postmaster working memory context in slotsync worker
Previous Message Tomas Vondra 2026-02-27 15:41:05 Re: index prefetching