Re: BUG #19059: PostgreSQL fails to evaluate the cheaper expression first, leading to 45X performance degradation

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #19059: PostgreSQL fails to evaluate the cheaper expression first, leading to 45X performance degradation
Дата
Msg-id 2524033.1758410343@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: BUG #19059: PostgreSQL fails to evaluate the cheaper expression first, leading to 45X performance degradation  (Christophe Pettus <xof@thebuild.com>)
Список pgsql-bugs
Christophe Pettus <xof@thebuild.com> writes:
> And tangentially, doesn't the SQL standard make it implementation-defined if OR short-circuits or not?

It looks like it says it's implementation-dependent, meaning
that not only is it not defined by the standard, but we're not
required to document it either:

    Subclause 6.3.3.3, “Rule evaluation order”:

    a) It is implementation-dependent whether expressions are
    actually evaluated from left to right when the precedence is
    not otherwise determined by the Formats or by parentheses.

    b) If evaluation of the inessential parts of an expression or
    search condition would cause an exception condition to be
    raised, then it is implementation-dependent whether or not
    that condition is raised.

    c) The declared type of a site that contains an intermediate
    result is implementation-dependent.

This is a good thing, because while we do mention boolean expression
re-ordering and short-circuiting, there's an awful lot of such details
that we've left undocumented.

            regards, tom lane



В списке pgsql-bugs по дате отправления: