From: | Zhihong Yu <zyu(at)yugabyte(dot)com> |
---|---|
To: | 曾文旌(义从) <wenjing(dot)zwj(at)alibaba-inc(dot)com> |
Cc: | Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>, wjzeng <wjzeng2012(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, shawn wang <shawn(dot)wang(dot)pg(at)gmail(dot)com>, "ggysxcq(at)gmail(dot)com" <ggysxcq(at)gmail(dot)com> |
Subject: | Re: 回复:Re: Re: 回复:Re: Is it worth pushing conditions to sublink/subplan? |
Date: | 2021-12-24 18:28:57 |
Message-ID: | CALNJ-vTJiOZLEgLG6foxZ8UOPg2yikRD+ovtQiiZQEfXupaqUw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, Dec 23, 2021 at 3:52 AM 曾文旌(义从) <wenjing(dot)zwj(at)alibaba-inc(dot)com> wrote:
>
> Fixed a bug found during testing.
>
>
> Wenjing
>
>
>>> Hi,
+ if (condition_is_safe_pushdown_to_sublink(rinfo,
expr_info->outer))
+ {
+ /* replace qual expr from outer var = const to var = const
and push down to sublink query */
+ sublink_query_push_qual(subquery, (Node
*)copyObject(rinfo->clause), expr_info->outer, expr_info->inner);
Since sublink_query_push_qual() is always guarded
by condition_is_safe_pushdown_to_sublink(), it seems
sublink_query_push_qual() can be folded into
condition_is_safe_pushdown_to_sublink().
For generate_base_implied_equalities():
+ if (ec->ec_processed)
+ {
+ ec_index++;
+ continue;
+ }
+ else if (list_length(ec->ec_members) > 1)
Minor comment: the keyword `else` can be omitted (due to `continue` above).
+ * Since there may be an unexpanded sublink in the targetList,
+ * we'll skip it for now.
Since there may be an -> If there is an
+ {"lazy_process_sublink", PGC_USERSET, QUERY_TUNING_METHOD,
+ gettext_noop("enable lazy process sublink."),
Looking at existing examples from src/backend/utils/misc/guc.c,
enable_lazy_sublink_processing seems to be consistent with existing guc
variable naming.
+lazy_process_sublinks(PlannerInfo *root, bool single_result_rte)
lazy_process_sublinks -> lazily_process_sublinks
+ else
+ {
/* There shouldn't be any OJ info to translate, as yet */
Assert(subroot->join_info_list == NIL);
Indentation for the else block is off.
+ if (istop)
+ f->quals = preprocess_expression_ext(root, f->quals,
EXPRKIND_QUAL, false);
+ else
+ f->quals = preprocess_expression_ext(root, f->quals,
EXPRKIND_QUAL, true);
The above can be written as:
+ f->quals = preprocess_expression_ext(root, f->quals,
EXPRKIND_QUAL, !istop);
For find_equal_conditions_contain_uplevelvar_in_sublink_query():
+ context.has_unexpected_expr == false &&
`!context.has_unexpected_expr` should suffice
equal_expr_safety_check -> is_equal_expr_safe
Cheers
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Dunstan | 2021-12-24 19:16:37 | Re: Proposal: sslmode=tls-only |
Previous Message | Bharath Rupireddy | 2021-12-24 14:34:08 | Re: add recovery, backup, archive, streaming etc. activity messages to server logs along with ps display |