From: | wenjing <wjzeng2012(at)gmail(dot)com> |
---|---|
To: | Zhihong Yu <zyu(at)yugabyte(dot)com> |
Cc: | 曾文旌(义从) <wenjing(dot)zwj(at)alibaba-inc(dot)com>, Tomas Vondra <tomas(dot)vondra(at)enterprisedb(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: | 2022-01-06 06:28:53 |
Message-ID: | CA+B_3VnGajJS1TtPGqw=xHCexzJtLGGkQG2c_U4hoS9syLe8dQ@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
I corrected it according to your suggestion.
thanks
Wenjing.
Zhihong Yu <zyu(at)yugabyte(dot)com> 于2021年12月25日周六 02:26写道:
>
>
> 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
>
>
Attachment | Content-Type | Size |
---|---|---|
0001-poc-pushdown-qual-to-sublink-v5.patch | application/octet-stream | 56.2 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Amit Langote | 2022-01-06 06:43:59 | Re: sqlsmith: ERROR: XX000: bogus varno: 2 |
Previous Message | Dilip Kumar | 2022-01-06 06:05:12 | Re: Throttling WAL inserts when the standby falls behind more than the configured replica_lag_in_bytes |