Re: BUG #10171: Specific prepared statement cannot use bitmapOr index scan since 9.2

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #10171: Specific prepared statement cannot use bitmapOr index scan since 9.2
Дата
Msg-id 17573.1398782967@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #10171: Specific prepared statement cannot use bitmapOr index scan since 9.2  (pilum.70@uni-muenster.de)
Список pgsql-bugs
pilum.70@uni-muenster.de writes:
> The following query uses bitmap or index scan in 9.1, but only Nested Loop
> in 9.2 and 9.3:

Interesting.  The plan actually gets stupider when it has values for the
parameters, if those values chance to be NULL.

The reason seems to be that after substituting the parameters and
constant-folding, we've got this join condition:

(t1.id2 = ''::text AND t2.id2 = ''::text) OR NULL::boolean

and the code in orclause.c is unable to realize that it can extract the
sub-AND elements as restriction clauses for t1 and t2.  But it'd be
all right to ignore the constant-null OR arm, since that can't possibly
succeed.

Another way of looking at this is that we should be smart enough to throw
away the constant-null OR arm altogether at top level of WHERE, since at
top level we don't particularly care whether the OR produces FALSE or NULL
if all its other inputs are FALSE.  That would probably be a more general
fix.

I'll see what I can do about this.  Thanks for the report!

            regards, tom lane

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

Предыдущее
От: pilum.70@uni-muenster.de
Дата:
Сообщение: BUG #10171: Specific prepared statement cannot use bitmapOr index scan since 9.2
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: Re: BUG #10142: Downstream standby indefinitely waits for an old WAL log in new timeline on WAL Cascading replicatio