Richard Huxton <[EMAIL PROTECTED]> writes:
> Boiling the problem down, I've looked at a clause of the form:
>   a OR (b AND c)
> which PG converts to:
>   (a OR b) AND (a OR c)

> Is it an artefact of displaying the EXPLAIN, or is it actually
> processed that way? You could see how testing "a" twice could be
> expensive in some situations.

It's actually done that way --- see the comments near the head of
src/backend/optimizer/prep/prepqual.c.  There are some heuristics
to not do it if the expression expands "a lot", though.

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

               http://archives.postgresql.org

Reply via email to