Re: Regression in IN( field, field, field ) performance

From: "Robert Haas" <robertmhaas(at)gmail(dot)com>
To: Decibel! <decibel(at)decibel(dot)org>
Cc: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Gregory Stark" <stark(at)enterprisedb(dot)com>, "Postgres Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Regression in IN( field, field, field ) performance
Date: 2008-10-25 18:31:06
Message-ID: 603c8f070810251131m4e9cf4efl8c6e877d1fbd2022@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2008-10-25 18:59:07 Re: Handling NULL records in plpgsql
Previous Message Tom Lane 2008-10-25 16:36:24 Re: Full socket send buffer prevents cancel, timeout