pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <hlinnakangas@vmware.com>
To: Dave Cramer <pg@fastcrypt.com>
Cc: pgsql-odbc@postgresql.org
Subject: Re: UseServerSidePrepare default
Date: Thu, 22 Aug 2013 14:15:04 +0300
Message-ID: <5215F2B8.4070807@vmware.com> (raw)
In-Reply-To: <CADK3HHKCcALxzYXmuKiRcmje7MGZ=ff-RStinkTH2auw8-7bMA@mail.gmail.com>
References: <517197A4.7020603@vmware.com>
	<5215B85D.7020908@vmware.com>
	<CADK3HHKCcALxzYXmuKiRcmje7MGZ=ff-RStinkTH2auw8-7bMA@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-odbc>

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



view thread (4+ messages)

Message-ID: <5215F2B8.4070807@vmware.com>
Permalink:  ../5215F2B8.4070807@vmware.com/
Also on:    postgresql.org/message-id/5215F2B8.4070807@vmware.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-odbc@postgresql.org
  Cc: hlinnakangas@vmware.com, pg@fastcrypt.com
  Subject: Re: UseServerSidePrepare default
  In-Reply-To: <5215F2B8.4070807@vmware.com>
  References: <517197A4.7020603@vmware.com> <5215B85D.7020908@vmware.com> <CADK3HHKCcALxzYXmuKiRcmje7MGZ=ff-RStinkTH2auw8-7bMA@mail.gmail.com> <5215F2B8.4070807@vmware.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox