Re: Extended statistics improvement: multi-column MCV missing values - Mailing list pgsql-hackers

From Enrique Sánchez
Subject Re: Extended statistics improvement: multi-column MCV missing values
Date
Msg-id CAOCkzAnYgzn0ZN4KUPngyiHQdcKHbF=KAxmCR-ObJVKirQvVLw@mail.gmail.com
Whole thread
Responses Re: Extended statistics improvement: multi-column MCV missing values
List pgsql-hackers
Hi,

1. Full-dimensional top-level AND equality miss, using the
ndistinct-based average estimate when matching ndistinct statistics
exist, with the least-MCV frequency as an upper bound; otherwise
using the cap alone.

I've implemented the ndistinct-based estimation and attached it as v3-0002. The patch applies cleanly and pg-ci.yml passes.

## v3-0001
- logic remains the same
- added a `IsA(clause, RestrictInfo)` check before casting to RestrictInfo in `mcv_can_cap()`
- added some tests

## v3-0002
- used ndistinct to calculate `non_mcv_sel = (1.0 - mcv_totalsel) / (ndistinct - mcv_nitems)` and applied it as an upper bound for non-MCV combinations, similarly to what `var_eq_const()` does in `selfuncs.c`

Looking forward to your feedback!

Best regards,
Enrique.
Attachment

pgsql-hackers by date:

Previous
From: Junwang Zhao
Date:
Subject: Re: Copy from JSON FORMAT.
Next
From: Álvaro Herrera
Date:
Subject: Re: [PATCH] Don't call ereport(ERROR) from recovery target GUC assign hooks