Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id CDB8A6331C5; Wed, 21 Apr 2010 14:59:05 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 40373-01; Wed, 21 Apr 2010 17:58:52 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail63.csoft.net (mail63.csoft.net [205.205.214.4]) by mail.postgresql.org (Postfix) with ESMTP id C17C8632F34; Wed, 21 Apr 2010 14:58:53 -0300 (ADT) Received: from mail63.csoft.net (localhost [127.0.0.1]) by mail63.csoft.net (Postfix) with ESMTP id CA08828427; Wed, 21 Apr 2010 13:58:51 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=csoft.net; h=date:from:to :cc:subject:in-reply-to:message-id:references:mime-version :content-type; s=sel1; bh=7VDBFnML3ozu6bnH9liw5YIskeU=; b=sj4jK3 DnVe9yACoTVy53WTMnsZs7LxiZV+ZSycbv6aGKrWr4oxQpIQHUtMqJPvE/89JDgV yyo2aXiaQMLS7YTjPC52KO8Y1tka+WreHKvx3/8yg4M+95TXSuA1Ms1XiR/NRaMQ cYDPfpcjXXAVudRXAujD4uA62B4PRuC6qVtFo= Received: from leary.csoft.net (leary.csoft.net [205.205.214.5]) by mail63.csoft.net (Postfix) with ESMTP id C6ECD2841F; Wed, 21 Apr 2010 13:58:51 -0400 (EDT) Received: by leary.csoft.net (Postfix, from userid 1112) id B91EAA425; Wed, 21 Apr 2010 13:58:51 -0400 (EDT) Date: Wed, 21 Apr 2010 13:58:51 -0400 (EDT) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: Robert Haas cc: Dave Crooke , Kevin Grittner , pgsql-jdbc@postgresql.org, pgsql-performance , Scott Carey Subject: Re: SOLVED ... Re: Getting rid of a cursor from JDBC .... Re: [PERFORM] Re: HELP: How to tame the 8.3.x JDBC driver with a biq guery result set In-Reply-To: Message-ID: References: <4BCD73AF0200002500030BC2@gw.wicourts.gov> <4BCD90D80200002500030BDD@gw.wicourts.gov> <4BCDC6B90200002500030C09@gw.wicourts.gov> User-Agent: Alpine 2.00 (BSO 1167 2008-08-23) MIME-Version: 1.0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.137 tagged_above=-10 required=5 tests=AWL=-0.227, BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: Content-Type: TEXT/PLAIN; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE X-Archive-Number: 201004/59 X-Sequence-Number: 20470 On Wed, 21 Apr 2010, Robert Haas wrote: > On Tue, Apr 20, 2010 at 5:05 PM, Kris Jurka wrote: >> >> b) Using the parameter values for statistics, but not making any stronger >> guarantees about them. =A0So the parameters will be used for evaluating = the >> selectivity, but not to perform other optimizations like contraint_exclu= sion >> or transforming a LIKE operation to a range query. This is the default p= lan >> type the JDBC driver uses. > > Hmm. I didn't think this was possible. How are you doing this? This is only possible at the protocol level, it's not available using SQL= =20 commands only. You do this by creating an unnamed instead of a named=20 statement: http://www.postgresql.org/docs/8.4/static/protocol-flow.html#PROTOCOL-FLOW-= EXT-QUERY Query planning for named prepared-statement objects occurs when the Parse message is processed. If a query will be repeatedly executed with different parameters, it might be beneficial to send a single Parse message containing a parameterized query, followed by multiple Bind and Execute messages. This will avoid replanning the query on each execution. The unnamed prepared statement is likewise planned during Parse processing if the Parse message defines no parameters. But if there are parameters, query planning occurs during Bind processing instead. This allows the planner to make use of the actual values of the parameters provided in the Bind message when planning the query. Kris Jurka=