Hi Ivan,
I tested the patch using the input provided in commands.sql and observed 
improvements in both planning and execution time. These optimizations are 
especially noticeable when working with a mulitple tables. Even when querying 
just a single table, there is a small improvement in planning and execution 
time, with differences ranging from 0.02 to 0.04 ms.

CREATE TABLE test_table (
    _id SERIAL PRIMARY KEY,
    _val TEXT NOT NULL
);

INSERT INTO test_table (_val) VALUES
('a'),
('b'),
('c'),
('d'),
('e');

EXPLAIN ANALYZE
SELECT *
FROM test_table
WHERE _val IN ('b', 'd', 'e');


EXPLAIN ANALYZE
SELECT *
FROM test_table
WHERE _val IN (VALUES ('b'), ('d'), ('e'));


The patch optimizes IN clauses effectively, especially when the syntax uses 
VALUES.

When writing queries like:
col IN (VALUES ('a'), ('b'), ('c'))

the optimization makes it behave similarly to:
col IN ('a', 'b', 'c')

This leads to faster query execution times and reduced planning overhead.

Best Regards,
PostgreSQL Contributiors - Newt Global
[cid:55b37106-ab02-4cf9-b703-3cf4294d4600]
Newt Global India Pvt. Ltd.
SSPDL Alpha City , Gamma Block,
25, Rajiv Gandhi Salai (OMR),
Navalur, Chennai - 600130 .

Reply via email to