Re: pgsql: Transform OR clauses to ANY expression

From: Melanie Plageman <melanieplageman(at)gmail(dot)com>
To: Alexander Korotkov <akorotkov(at)postgresql(dot)org>
Cc: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: Transform OR clauses to ANY expression
Date: 2024-04-07 22:35:21
Message-ID: CAAKRu_b4SXNW4GAM0bv3e6wcL5ODSXg1ZdRCn6uyLLjSPbveBg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

On Sun, Apr 7, 2024 at 6:28 PM Alexander Korotkov
<akorotkov(at)postgresql(dot)org> wrote:
>
> Transform OR clauses to ANY expression
>
> Replace (expr op C1) OR (expr op C2) ... with expr op ANY(ARRAY[C1, C2, ...])
> on the preliminary stage of optimization when we are still working with the
> expression tree.
>
> Here Cn is a n-th constant expression, 'expr' is non-constant expression, 'op'
> is an operator which returns boolean result and has a commuter (for the case
> of reverse order of constant and non-constant parts of the expression,
> like 'Cn op expr').
>
> Sometimes it can lead to not optimal plan. This is why there is a
> or_to_any_transform_limit GUC. It specifies a threshold value of length of
> arguments in an OR expression that triggers the OR-to-ANY transformation.
> Generally, more groupable OR arguments mean that transformation will be more
> likely to win than to lose.

I'm getting this warning now

/src/backend/optimizer/prep/prepqual.c:582:33: warning: declaration of
‘lc__state’ shadows a previous local [-Wshadow=compatible-local]
582 | foreach(lc, entry->consts)

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Alexander Korotkov 2024-04-07 22:38:06 Re: pgsql: Transform OR clauses to ANY expression
Previous Message Alexander Korotkov 2024-04-07 22:28:06 pgsql: Transform OR clauses to ANY expression