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: Tatsuya Kawata <kawatatatsuya0913(at)gmail(dot)com>, David Geier <geidav(dot)pg(at)gmail(dot)com>, Chengpeng Yan <chengpeng_yan(at)outlook(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-02-25 21:39:05
Message-ID: CAN4CZFPb+iqQkby4AGvZSvL2OkwQ+S9CVvmJiQ=u6cckWPetqA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello

+ hashContext.hash_fcinfo = hash_fcinfo;
+ hashContext.op_is_reversed = !hash_mcv;
+ hashContext.insert_mode = true;

Are you sure about op_is_reversed, isn't it backwards, shouldn't it be
= hash_mcv instead?

See the following testcase:

CREATE TABLE test_cross_type_bug (val float4);

INSERT INTO test_cross_type_bug
SELECT v
FROM generate_series(1, 200) AS v,
generate_series(1, 50);

ALTER TABLE test_cross_type_bug ALTER COLUMN val SET STATISTICS 200;
ANALYZE test_cross_type_bug;

SELECT string_agg(v::text, ', ') AS in_list
FROM generate_series(1, 200) AS gs(v) \gset

EXPLAIN SELECT * FROM test_cross_type_bug
WHERE val = ANY(ARRAY[:in_list]::float4[]);

EXPLAIN SELECT * FROM test_cross_type_bug
WHERE val = ANY(ARRAY[:in_list]::float8[]);

DROP TABLE test_cross_type_bug;

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Sami Imseih 2026-02-25 21:53:09 Re: Fix bug in multixact Oldest*MXactId initialization and access
Previous Message Matheus Alcantara 2026-02-25 21:29:23 Re: Initial COPY of Logical Replication is too slow