Обсуждение: Feature request: pgsql's CASE...WHEN optimization

Поиск
Список
Период
Сортировка

Feature request: pgsql's CASE...WHEN optimization

От
pasman pasmański
Дата:
Hi.

I think that in specific statement with many constants:

CASE x
  WHEN const1 THEN action1
  WHEN const2 THEN action2
  WHEN const3 THEN action3
  WHEN const4 THEN action4
END CASE;

constants may be sorted at compile time, and when executed ,
it will be possible internally to use fast search:

IF x<=const2 THEN
    IF x=const1 THEN action1
                        ELSE action2
    END IF;
ELSE
     IF x=const3 THEN action3
                          ELSE action4
    END IF;
END IF;



------------
pasman