Skip site navigation (1) Skip section navigation (2)

Re: [JDBC] Prepared statement performance...

From: Barry Lind <barry(at)xythos(dot)com>
To: Dmitry Tkach <dmitry(at)openratings(dot)com>
Cc: Peter Kovacs <peter(dot)kovacs(at)sysdata(dot)siemens(dot)hu>,pgsql-general(at)postgresql(dot)org, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: [JDBC] Prepared statement performance...
Date: 2002-09-27 20:04:55
Message-ID: 3D94B9E7.7060903@xythos.com (view raw or flat)
Thread:
Lists: pgsql-generalpgsql-jdbc

Dmitry Tkach wrote:
> 
> BTW, here is a quote from JDBC javadoc:
> 
> * An object that represents a precompiled SQL statement.
> * <P>A SQL statement is precompiled and stored in a
> * <code>PreparedStatement</code> object. This object can then be used to
> * efficiently execute this statement multiple times.
> 
> I read 'precompiled' as something more than 'parsed for question marks' :-)
> And also note the phrase about being able to 'efficiently execute this 
> statement multiple times'...
> 

I don't read more into this than simply parsing question marks.  It is 
all going to depend on the capabilities of the server.  To the extent 
the server has additional features that can be leveraged to improve the 
performance those should be used.  Up until 7.3 of postgres no such 
features existed.  Now they do and we are exploring how to best take 
advantage of them.  But it doesn't make sense to use a specific server 
feature if it doesn't improve performance in the general case.  The 
testing I have done so far indicates that using the current 
implementation of server side prepared statements doesn't help 
performance in the general case and may hinder it.  I am reluctant to 
make a non-backwardly compatible change in the driver until more data 
points come in that there are significant performance improvements 
possible without decreasing performance in the general case.


> It seems quite clear to me that it states the intent behind having this 
> interface to provide the ability for the users to
> parse a query once and be able to execute it again and again...
> As for the set*() functions,  PreparedStatement without them would be of 
> very limited use (how often would we need to execute
> *the same exact query* multiple times???), and that's the reason it has 
> them, *not* to abstract from the database data representation format...
> 

I have many statements that don't take any arguments and that do get 
executed multiple times.  It all depends on the nature of the application.

thanks,
--Barry



In response to

pgsql-jdbc by date

Next:From: Barry LindDate: 2002-09-27 20:17:12
Subject: Re: [JDBC] Prepared statement performance...
Previous:From: Barry LindDate: 2002-09-27 19:29:00
Subject: Re: [JDBC] Prepared statement performance...

pgsql-general by date

Next:From: Lamar OwenDate: 2002-09-27 20:15:31
Subject: Re: 7.0 -> 7.2 Migration (oops)
Previous:From: Jean-Luc LachanceDate: 2002-09-27 19:32:41
Subject: Re: cache state reset

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group