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

From: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
To: Ilia Evdokimov <ilya(dot)evdokimov(at)tantorlabs(dot)com>
Cc: David Geier <geidav(dot)pg(at)gmail(dot)com>, Chengpeng Yan <chengpeng_yan(at)outlook(dot)com>, Tatsuya Kawata <kawatatatsuya0913(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-03-11 08:01:37
Message-ID: CAN4CZFOJ2nwOvLzkg_5n0NPfn37_as_O6th7OXey1it0UUhWKA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

+ if (elem_nulls[i])
+ {
+ nonmcv_cnt--;
+ continue;
+ }

> The patch v8 can still be reviewed as-is, and if the selectivity
> regression test gets committed [0], I will add corresponding tests for
> this change as well.

Without [0], the const path will return incorrect results for <> ALL
and NULLs. Compared to that, the other path still has special handling
in it:

+ /*
+ * For ALL semantics, if the array contains NULL, assume
+ * operator is strict. The ScalarArrayOpExpr cannot
+ * evaluate to TRUE, so return zero.
+ */

+ nonconst_sel = var_eq_non_const(&vardata, operator,
+ clause->inputcollid,
+ other_op, var_on_left,
+ isInequality);

+ if (isInequality)
+ individual_s = 1.0 - individual_s - nullfrac;

Isn't this the double negation issue again, which was once
mentioned/fixed earlier?

+ int count; /* number of occurrences of current value in */

That's a truncated comment

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message shveta malik 2026-03-11 08:45:19 Re: synchronized_standby_slots behavior inconsistent with quorum-based synchronous replication
Previous Message Hayato Kuroda (Fujitsu) 2026-03-11 07:55:36 RE: Patch for migration of the pg_commit_ts directory