pgsql: Add a heuristic to transformAExprIn() to make it prefer expanding

Поиск
Список
Период
Сортировка
От tgl@postgresql.org (Tom Lane)
Тема pgsql: Add a heuristic to transformAExprIn() to make it prefer expanding
Дата
Msg-id 20081025171917.58D787545A4@cvs.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Log Message:
-----------
Add a heuristic to transformAExprIn() to make it prefer expanding "x IN (list)"
into an OR of equality comparisons, rather than x = ANY(ARRAY[...]), when there
are Vars in the right-hand side.  This avoids a performance regression compared
to pre-8.2 releases, in cases where the OR form can be optimized into scans
of multiple indexes.  Limit the possible downside by preferring this form only
when the list isn't very long (I set the cutoff at 32 elements, which is a
bit arbitrary but in the right ballpark).  Per discussion with Jim Nasby.

In passing, also make it try the OR form if it cannot select a common type
for the array elements; we've seen a complaint or two about how the OR form
worked for such cases and ARRAY doesn't.

Tags:
----
REL8_3_STABLE

Modified Files:
--------------
    pgsql/src/backend/parser:
        parse_coerce.c (r2.161 -> r2.161.2.1)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/parser/parse_coerce.c?r1=2.161&r2=2.161.2.1)
        parse_expr.c (r1.226.2.1 -> r1.226.2.2)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/parser/parse_expr.c?r1=1.226.2.1&r2=1.226.2.2)

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

Предыдущее
От: tgl@postgresql.org (Tom Lane)
Дата:
Сообщение: pgsql: Add a heuristic to transformAExprIn() to make it prefer expanding
Следующее
От: tgl@postgresql.org (Tom Lane)
Дата:
Сообщение: pgsql: Add a heuristic to transformAExprIn() to make it prefer expanding