X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 2ADA3D1DC7D; Mon, 19 Apr 2004 22:02:37 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 84662-01; Mon, 19 Apr 2004 22:02:38 -0300 (ADT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 82CC0D1BB93; Mon, 19 Apr 2004 22:02:34 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i3K12c7E002047; Mon, 19 Apr 2004 21:02:38 -0400 (EDT) To: James Robinson Cc: pgsql-jdbc@postgresql.org, pgsql-sql@postgresql.org Subject: Re: [SQL] Prepared Statements and large where-id-in constant blocks? In-reply-to: <11531DB4-921A-11D8-8696-000A9566A412@socialserve.com> References: <11531DB4-921A-11D8-8696-000A9566A412@socialserve.com> Comments: In-reply-to James Robinson message dated "Mon, 19 Apr 2004 11:56:06 -0400" Date: Mon, 19 Apr 2004 21:02:38 -0400 Message-ID: <2046.1082422958@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200404/191 X-Sequence-Number: 9920 James Robinson 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