Feature request: pgsql's CASE...WHEN optimization - Mailing list pgsql-general

From pasman pasmański
Subject Feature request: pgsql's CASE...WHEN optimization
Date
Msg-id CAOWY8=YLrqNrSEvjcHKTyrczTSePUQtLTv6LKc5pS=MPPZ2HQg@mail.gmail.com
Whole thread Raw
List pgsql-general
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

pgsql-general by date:

Previous
From: Brice Maron
Date:
Subject: Immutable function with bind value
Next
From: Andreas Lubensky
Date:
Subject: ODBC and bytea