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

From: pasman pasmański <pasman(dot)p(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Feature request: pgsql's CASE...WHEN optimization
Date: 2012-01-20 12:47:06
Message-ID: CAOWY8=YLrqNrSEvjcHKTyrczTSePUQtLTv6LKc5pS=MPPZ2HQg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Browse pgsql-general by date

  From Date Subject
Next Message maripabis@tiscali.it 2012-01-20 13:26:28 Does Stackbuilder need username/pwd for the proxy?
Previous Message Brice Maron 2012-01-20 11:43:25 Immutable function with bind value