| From: | Chengpeng Yan <chengpeng_yan(at)outlook(dot)com> |
|---|---|
| To: | Enrique Sánchez <enriqueesanchz(at)gmail(dot)com> |
| Cc: | "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>, Ilia Evdokimov <ilya(dot)evdokimov(at)tantorlabs(dot)com> |
| Subject: | Re: Extended statistics improvement: multi-column MCV missing values |
| Date: | 2026-07-26 03:15:56 |
| Message-ID: | DAE626CB-2E82-4441-AB98-D8E8B8ECE6F2@outlook.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
> On Jul 14, 2026, at 05:52, Enrique Sánchez <enriqueesanchz(at)gmail(dot)com> 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Jacob Brazeal | 2026-07-26 04:23:00 | Re: remove_useless_joins vs. bug #19560 |
| Previous Message | Jacob Brazeal | 2026-07-26 03:13:51 | Partition pruning can incorrectly exclude a RANGE default partition |