Skip to content

Conversation

@TiNnNnnn
Copy link

@TiNnNnnn TiNnNnnn commented Feb 4, 2026

Add inlist2subquery rewrite rule.

Control parameters

two parameters were added:

in_predicate_conversion_enable 
in_predicate_conversion_threshold

simple example:

txsql> explain format = 'tree' SELECT * FROM t1 WHERE a IN (1,2,3,4);
+-------------------------------------------------------------------------------------------------+
| EXPLAIN                                                                                         |
+-------------------------------------------------------------------------------------------------+
| -> Filter: (t1.a in (1,2,3,4))  (cost=1.20 rows=2)
-> Table scan on t1  (cost=1.20 rows=2)
|
+-------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

After enable inlist2subquery rewrite rule:

txsql> explain format = 'tree' SELECT * FROM t1 WHERE a IN (1,2,3,4);
+-------------------------------------------------------------------------------------------------+
| EXPLAIN                                                                                         |
+-------------------------------------------------------------------------------------------------+
| -> Inner hash join (t1.a = tvc_0._col_1)  (cost=3.16 rows=1)
    -> Table scan on t1  (cost=0.35 rows=3)
    -> Hash
        -> Table scan on tvc_0  (cost=2.51..2.51 rows=1)
            -> Materialize  (cost=2.61..2.61 rows=1)
                -> Rows fetched before execution  (cost=0.00..0.00 rows=1)
 |
+-------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)


rewriter2

Performance Test Under Different size of in-list

simple_test

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants