Re: [SQL] Prepared Statements and large where-id-in constant blocks? - Mailing list pgsql-jdbc

From Tom Lane
Subject Re: [SQL] Prepared Statements and large where-id-in constant blocks?
Date
Msg-id 2046.1082422958@sss.pgh.pa.us
Whole thread Raw
In response to Prepared Statements and large where-id-in constant blocks?  (James Robinson <jlrobins@socialserve.com>)
List pgsql-jdbc
James Robinson <jlrobins@socialserve.com> writes:
> where there may be anywhere between 1 and thousands of "(id = N)"
> blocks ORed together. These may be transformed to the "WHERE t1.id IN
> (X, Y, ...)" form for possibly a little performance gain (possibly --
> I've not yet checked to see if this plans better than the other, but I
> could imagine this form being parsed into the hashjoin form as opposed
> to a huge index filter form).

There is *no difference whatever*; in fact the PG parser expands an IN
clause into an OR'd list.

Possibly this is something to improve someday, but there's surely no
percentage in doing lots of work in the JDBC driver to prefer the IN
form at the moment.

            regards, tom lane

pgsql-jdbc by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: EXECUTE command tag returns actual command
Next
From: Oliver Jowett
Date:
Subject: Re: Prepared Statements and large where-id-in constant blocks?