On Fri, 16 Oct 2026 at 05:20, zengxx <xiangxin_zeng(at)qq(dot)com> wrote:
> return DEFAULT_NUM_DISTINCT. A union containing millions of keys
> therefore looks like a 200-distinct-value domain. That can make a
> semi-join estimate that nearly every outer row matches, undercount
> GROUP BY/DISTINCT output groups, or overstate Memoize hit rates.
If that's true for Memoize, please provide a test case that shows a
Memoize node being used on a DEFAULT_NUM_DISTINCT estimate. There's
specific coding in cost_memoize_rescan() which is meant to stop that
from happening.
David