Re: Regression in IN( field, field, field ) performance - Mailing list pgsql-hackers

From Robert Haas
Subject Re: Regression in IN( field, field, field ) performance
Date
Msg-id 603c8f070810251131m4e9cf4efl8c6e877d1fbd2022@mail.gmail.com
Whole thread Raw
In response to Re: Regression in IN( field, field, field ) performance  (Decibel! <decibel@decibel.org>)
Responses Re: Regression in IN( field, field, field ) performance
List pgsql-hackers
> There's 6 cases here, in a 2x3 array. In one dimension, the LHS can be
> either a Var or a fixed value. In the other dimension, the three
> possibilities are 1: everything on the RHS is a fixed value, 2: some fixed,
> some not, 3: everything on the RHS is a variable:
[...lengthy discussion of cases...]

It seems like you're saying that the only time the array wins here is
when you're comparing an expression against a whole bunch of
constants.  Given that, would it make any sense to put all the
constants in an ARRAY and use OR for any variables?  i.e. given

Whatever IN (Const1, Var1, Const2, Var2, Const3, Var3)

Generate:

Whatever = ANY (ARRAY[Const1, Const2, Const3]) OR Whatever = Var1 OR
Whatever = Var2 OR Whatever = Var3

...Robert


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Full socket send buffer prevents cancel, timeout
Next
From: "Robert Haas"
Date:
Subject: Re: Handling NULL records in plpgsql