Hi,

> On Jul 14, 2026, at 05:52, Enrique Sánchez <[email protected]> wrote:
> 
> Hi, I've rebased my patch as [1] got merged.
> 
> [1] 
> https://www.postgresql.org/message-id/flat/d639aede-209f-412b-927a-d38d4848b370%40eisentraut.org
> 
> Best regards,
> Enrique.
> <v6-0002-Use-ndistinct-to-cap-non-MCV-values.patch><v6-0001-Cap-selectivity-when-values-are-not-in-multi-colu.patch>

For patch 0001, apart from Ilia's comments, I only have one minor issue
with a comment in `mcv_can_cap()`:

Expressions are not supported, they can match multiple rows.

is not quite accurate. Matching multiple rows is not specific to
expressions; ordinary equality clauses may do so as well when they do
not fully constrain all dimensions. Expressions are excluded here
instead because the current full-coverage check only considers columns.

Other than that, patch 0001 looks good to me.

Regarding patch 0002, the formula seems reasonable as an estimate, but I
am not convinced that it can serve as an upper bound. Some non-MCV
combinations may be more frequent than the average, so using it as a cap
does not seem justified. It may be more or less accurate than the
existing per-column estimate depending on the data distribution.

--
Best regards,
Chengpeng Yan

Reply via email to