Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VCSrO-0000CK-39 for pgsql-odbc@arkaria.postgresql.org; Thu, 22 Aug 2013 11:15:26 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VCSrN-0008IS-17 for pgsql-odbc@arkaria.postgresql.org; Thu, 22 Aug 2013 11:15:25 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VCSrM-0008IL-3r for pgsql-odbc@postgresql.org; Thu, 22 Aug 2013 11:15:24 +0000 Received: from smtp-outbound-1.vmware.com ([208.91.2.12]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VCSr7-0007d2-RD for pgsql-odbc@postgresql.org; Thu, 22 Aug 2013 11:15:22 +0000 Received: from sc9-mailhost3.vmware.com (sc9-mailhost3.vmware.com [10.113.161.73]) by smtp-outbound-1.vmware.com (Postfix) with ESMTP id A218628A77; Thu, 22 Aug 2013 04:15:08 -0700 (PDT) Received: from zcs-prod-ext-mta-2.vmware.com (zcs-prod-ext-mta-2.vmware.com [10.113.62.224]) by sc9-mailhost3.vmware.com (Postfix) with ESMTP id 9D16C4033D; Thu, 22 Aug 2013 04:15:08 -0700 (PDT) Received: from zcs-prod-ext-mta-2.vmware.com (localhost.localdomain [127.0.0.1]) by zcs-prod-ext-mta-2.vmware.com (Postfix) with ESMTP id 95E95C0046; Thu, 22 Aug 2013 04:15:14 -0700 (PDT) Received: from [192.168.1.90] (zimbra-prod-ext-proxy-vip.vmware.com [10.113.63.87]) by zcs-prod-ext-mta-2.vmware.com (Postfix) with ESMTPSA; Thu, 22 Aug 2013 04:15:13 -0700 (PDT) Message-ID: <5215F2B8.4070807@vmware.com> Date: Thu, 22 Aug 2013 14:15:04 +0300 From: Heikki Linnakangas Organization: VMware User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130116 Icedove/10.0.12 MIME-Version: 1.0 To: Dave Cramer CC: pgsql-odbc@postgresql.org Subject: Re: UseServerSidePrepare default References: <517197A4.7020603@vmware.com> <5215B85D.7020908@vmware.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -9.7 (---------) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-odbc Precedence: bulk Sender: pgsql-odbc-owner@postgresql.org On 22.08.2013 13:57, Dave Cramer wrote: > I presume this is similar to JDBC's use of server side prepare. Yeah, it's similar. In psqlodbc, though, it controls more than just whether to use unnamed or named plans in the server. With UseServerSidePrepare=0, parameters are handled completely in the driver, replacing the parameter markers with the values in the query itself. IIRC the jdbc driver used to do that too, in older versions - psqlodbc still does that. (I'm planning to change that, so that parameters are always bound using extended query protocol, but not in the 9.3 version yet). > If so do you see a performance problem with servers older than 9.2 > since Tom's fix to planning prepared statements is only in 9.2 and > above ? Yeah, it's certainly possible. There's one thing that makes it less likely to be a problem than with JDBC, though. The ODBC API doesn't conflate prepared statements with parameterized queries like the JDBC API does. There is a function called SQLExecDirect() which is used to immediately execute a given SQL statement (ie. the query is passed as a string), with given parameters. If you want to execute the statement many times, you use a different function, SQLPrepare(), to prepare it once and execute many times. SQLExecDirect() always uses unnamed plans, even with UseServerSidePrepare=1. But yeah, there may well be applications where UseServerSidePrepare=1 gives a performance hit, especially when running against < 9.2 servers. It's still a better default IMHO, you can still turn it off if you have to. - Heikki -- Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-odbc