Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 8C22B6326C3 for ; Sat, 29 Aug 2009 05:55:53 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 39489-05 for ; Sat, 29 Aug 2009 08:55:38 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from tremor.opencloud.co.nz (tremor.opencloud.co.nz [131.203.101.230]) by mail.postgresql.org (Postfix) with ESMTP id CB77A6321F5 for ; Sat, 29 Aug 2009 05:55:42 -0300 (ADT) Received: from 122-57-44-76.jetstream.xtra.co.nz ([122.57.44.76] helo=[192.168.1.3]) by tremor.opencloud.co.nz with esmtpsa (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1MhJig-0002Xb-Jx; Sat, 29 Aug 2009 20:55:34 +1200 Message-ID: <4A98ED05.6090302@opencloud.com> Date: Sat, 29 Aug 2009 20:55:33 +1200 From: Oliver Jowett User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) MIME-Version: 1.0 To: Brett Henderson CC: pgsql-jdbc@postgresql.org Subject: Re: Prepared Statement Query Planning References: <4A9892E5.4010509@bretth.com> In-Reply-To: <4A9892E5.4010509@bretth.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200908/82 X-Sequence-Number: 19931 Brett Henderson wrote: > The full JDBC trace with loglevel=2 is below. Is it possible to tell > whether server side prepared statements are being used from this? Note > that this has been obtained from a windows laptop running PostgreSQL > 8.3.5, but the real problem is occurring on an Ubuntu Linux server > running PostgreSQL 8.3.7. The same JDBC driver is being used across the > board. > 17:48:46.443 (1) FE=> Parse(stmt=S_2,query="SELECT e.id, e.version, > e.timestamp, e.visible, u.data_public, u.id AS user_id, u.display_name, > e.changeset_id, e.latitude, e.longitude FROM nodes e LEFT OUTER JOIN > changesets c ON e.changeset_id = c.id LEFT OUTER JOIN users u ON > c.user_id = u.id WHERE e.timestamp > $1 AND e.timestamp <= $2 ORDER BY > e.id, e.version",oids={0,0}) > 17:48:46.444 (1) FE=> Describe(statement=S_2) > 17:48:46.444 (1) FE=> Bind(stmt=S_2,portal=C_3,$1=<1970-01-01 > 10:00:00.000000 +10:00:00>,$2=<2009-08-28 17:48:45.932000 +10:00:00>) > 17:48:46.445 (1) FE=> Execute(portal=C_3,limit=10000) > 17:48:46.445 (1) FE=> Sync This is using a named statement (S_2 is the name) It looks like you're using setFetchSize(). That forces use of a named statement regardless of prepareThreshold (we have to keep the statement and corresponding portal alive so we can do subsequent fetches, even if there are some other intervening queries, so we can't use the unnamed statement) -O