Skip site navigation (1) Skip section navigation (2)

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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: James Robinson <jlrobins(at)socialserve(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: Re: [SQL] Prepared Statements and large where-id-in constant blocks?
Date: 2004-04-20 01:02:38
Message-ID: 2046.1082422958@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-jdbcpgsql-sql
James Robinson <jlrobins(at)socialserve(dot)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

In response to

pgsql-sql by date

Next:From: Tom LaneDate: 2004-04-20 01:11:33
Subject: Re: relation X does not exist
Previous:From: Oliver JowettDate: 2004-04-19 22:21:02
Subject: Re: Prepared Statements and large where-id-in constant blocks?

pgsql-jdbc by date

Next:From: Oliver JowettDate: 2004-04-20 02:57:53
Subject: Re: Prepared Statements and large where-id-in constant blocks?
Previous:From: Bruce MomjianDate: 2004-04-20 00:58:49
Subject: Re: EXECUTE command tag returns actual command

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group