| From: | ZizhuanLiu X-MAN <44973863(at)qq(dot)com> |
|---|---|
| To: | ZizhuanLiu X-MAN <44973863(at)qq(dot)com>, pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Optimize mergejoinscansel() by avoiding redundant computations |
| Date: | 2026-10-26 03:55:25 |
| Message-ID: | tencent_C382E87BD2929DFABE51009EB30D8AD66305@qq.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi
Build on v2 by adding checks in the recursive calls to find_relation_rte() to ensure that
the relevant Var properties match, as shown below:
/*
* We can only recurse through a simple Var of the subquery's query
* level, and only if its varattno, vartype, vartypmod, varcollid, and
* varreturningtype properties match those of the upper Var.
*/
if (tmpvar && IsA((tmpvar), Var) &&
tmpvar->varlevelsup == 0)
{
if (tmpvar->varattno <= 0 ||
tmpvar->vartype != (*var)->vartype ||
tmpvar->vartypmod != (*var)->vartypmod ||
tmpvar->varcollid != (*var)->varcollid ||
tmpvar->varreturningtype != (*var)->varreturningtype)
goto fail;
/* OK, recurse into the subquery. */
*var = tmpvar;
return find_relation_rte(subroot, var);
}
Also, revise the comments in find_relation_rte() and simplify its implementation, using examine_simple_variable() as a reference.
regards,
--
ZizhuanLiu (X-MAN)
44973863(at)qq(dot)com
| Attachment | Content-Type | Size |
|---|---|---|
| v3-0001-Optimize-mergejoinscansel-by-avoiding-redundant-c.patch | application/octet-stream | 18.7 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | shihao zhong | 2026-10-26 03:55:32 | Re: Let's drop support for named POSIX semaphores |
| Previous Message | Kirill Reshke | 2026-10-26 03:52:31 | Event trigger table rewrite doc missing ALTER MATERIALIZED VIEW case |