| From: | ZizhuanLiu X-MAN <44973863(at)qq(dot)com> |
|---|---|
| To: | cca5507 <cca5507(at)qq(dot)com>, Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Cc: | 我自己的邮箱 <44973863(at)qq(dot)com> |
| Subject: | Re: Make transformAExprIn() return a flattened bool expression directly |
| Date: | 2026-05-31 11:39:06 |
| Message-ID: | tencent_E9754A23203C449B2BEDE9C4D83785651A06@qq.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
>From: cca5507 <cca5507(at)qq(dot)com>
>Date: 2026-04-30 18:16
>To: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
>Cc: pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
>Subject: Re: Make transformAExprIn() return a flattened bool expression directly
>
>
> Hi Chao,
>
>Thanks for your comments. I have created a CF entry:
>
>https://commitfest.postgresql.org/patch/6723/
>
>--
>Regards,
>ChangAo Chen
Hi, ChangAo, Chao, Hackers,
``
Thanks a lot for the suggestion to avoid nested structures in transformAExprIn().
I also agree that handling this kind of simplification during parsing is cleaner and more appropriate,
even though the planner can achieve a similar effect later via preprocess_qual_conditions().
``
I further refined and polished this implementation based on v1 patch. I intentionally keep
all the core logic inside the existing foreach(l, rexprs) loop. This way better preserves the integrity of
the function, minimizes code intrusion, and makes the overall logic easier to follow. I put careful thought
into this implementation, and more details are documented in the code comments.
``
I have updated the patch accordingly and prepared corresponding test cases to cover the modified scenarios,
ensuring the correctness and stability of the optimization.
``
Any feedback and further suggestions are highly appreciated.
create table t1(id int);
create table t2(id int);
create table t3(id int);
explain select t1.* from t1, t2, t3 where t1.id in (1);
explain select t1.* from t1, t2, t3 where t1.id in (1,1);
explain select t1.* from t1, t2, t3 where t1.id in (t2.id);
explain select t1.* from t1, t2, t3 where t1.id in (t2.id, t2.id);
explain select t1.* from t1, t2, t3 where t1.id in (1, t2.id, t2.id, 1);
explain select t1.* from t1, t2, t3 where (t1.id,t2.id) in ((1, 11));
explain select t1.* from t1, t2, t3 where (t1.id,t2.id) in ((1,11),(1,11));
explain select t1.* from t1, t2, t3 where (t1.id,t2.id) in ((t2.id, t2.id));
explain select t1.* from t1, t2, t3 where (t1.id,t2.id) in ((t2.id, t2.id),(t2.id, t2.id));
explain select t1.* from t1, t2, t3 where (t1.id,t2.id) in ((1,11), (t2.id, t2.id),(t2.id, t2.id), (1,11));
Thanks,
--
ZizhuanLiu (X-MAN)
44973863(at)qq(dot)com
| Attachment | Content-Type | Size |
|---|---|---|
| v2-0001-Make-transformAExprIn-return-a-flattened-bool-exp.patch | application/octet-stream | 1.6 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Amit Kapila | 2026-05-31 11:54:08 | Re: Proposal: Conflict log history table for Logical Replication |
| Previous Message | Tender Wang | 2026-05-31 11:28:37 | Re: Eager aggregation, take 3 |