Re: Hash-based MCV matching for large IN-lists

From: Ilia Evdokimov <ilya(dot)evdokimov(at)tantorlabs(dot)com>
To: Chengpeng Yan <chengpeng_yan(at)Outlook(dot)com>
Cc: David Geier <geidav(dot)pg(at)gmail(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Hash-based MCV matching for large IN-lists
Date: 2026-01-29 11:14:43
Message-ID: 8ee9d903-bb13-434c-8145-b3769bf2b3cb@tantorlabs.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Chengpeng,

Thanks for your review!

On 28.01.2026 16:08, Chengpeng Yan wrote:
> * Treat NULL array elements as zero selectivity for ALL:

Agreed. For ALL/AND semantics the function now returns selectivity = 0.0
as soon as a NULL element is encountered.

> * Fix cross-type equality argument order in `mcvs_in_equal`:

Agreed. Added 'op_is_reserved' flag MCVInHashContext, same as in
MCVHashContext.

> * Include non-MCV IN-list constants in non-disjoint selectivity:

This is not applicable to v3.

> * Avoid double-negating inequality estimates for non-Const elements:

Agreed. var_eq_non_const() is now always with negate = false, not to
call negation twice.

Attached v4 patch with above fixes.

--
Best regards,
Ilia Evdokimov,
Tantor Labs LLC,
https://tantorlabs.com/

Attachment Content-Type Size
v4-0001-Use-hash-based-MCV-matching-for-ScalarArrayOpExpr.patch text/x-patch 22.2 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message shveta malik 2026-01-29 11:16:10 Re: Proposal: Conflict log history table for Logical Replication
Previous Message Ajin Cherian 2026-01-29 11:13:21 Re: Fix logical decoding not track transaction during SNAPBUILD_BUILDING_SNAPSHOT