Re: Improvement of var_eq_non_const()

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Teodor Sigaev <teodor(at)sigaev(dot)ru>
Cc: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Improvement of var_eq_non_const()
Date: 2025-02-20 18:21:25
Message-ID: 2781865.1740075685@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Teodor Sigaev <teodor(at)sigaev(dot)ru> writes:
> I'd like to suggest to improve var_eq_non_const() by using knowledge of MCV and
> estimate the selectivity as quadratic mean of non-null fraction divided by
> number of distinct values (as it was before) and set of MCV selectivities.

What's the statistical interpretation of this calculation (that is,
the average MCV selectivity)? Maybe it's better, but without any
context it seems like a pretty random thing to do. In particular,
it seems like this could give radically different answers depending
on how many MCVs we chose to store, and I'm not sure we could argue
that the result gets more accurate with more MCVs stored.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2025-02-20 18:21:59 Re: Proposal: pg_is_volatile function
Previous Message Paul Jungwirth 2025-02-20 18:12:20 Patch Review Workshop