Re: Fix var_eq_const: sum selectivity of all matching MCV entries instead of stopping at first match

From: Damil Shahzad <shahzaddamil(at)gmail(dot)com>
To: Zizhuan Liu <44973863(at)qq(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Fix var_eq_const: sum selectivity of all matching MCV entries instead of stopping at first match
Date: 2026-08-05 10:42:05
Message-ID: CALRDUFq0WaUKjeVBrTVovTcsF9X+VpBdmwy7gnpkckad2n3Nyg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi ZizhuanLiu,

Thanks for the update and the spreadsheet. That analysis is helpful.

I agree with the narrowed conclusion full MCV scanning only looks

justified when the column collation is deterministic and the expression

uses a non deterministic collation. In the other cases, keeping the

current first match behavior seems right.

If you post a revised patch that does the full scan only in that case,

I am happy to retest it.

Thanks,

Damil Shahzad

On Wed, 5 Aug 2026 at 15:37, Zizhuan Liu <44973863(at)qq(dot)com> wrote:

> >That would double the function's runtime on average, without changing
> >the results at all in most cases (it could only be different if the
> >given operator has different semantics from the equality operator used
> >while building the statistics list).
>
> So I agree with Tom’s reasoning.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message ZizhuanLiu X-MAN 2026-08-05 10:44:46 Re: Fix var_eq_const: sum selectivity of all matching MCV entries instead of stopping at first match
Previous Message Zizhuan Liu 2026-08-05 10:36:11 Re: Fix var_eq_const: sum selectivity of all matching MCV entries instead of stopping at first match