db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Øystein Grøvlen <Oystein.Grov...@Sun.COM>
Subject Re: Derby select query speed questions
Date Sat, 14 Apr 2007 08:11:18 GMT
Adam Bovill wrote:
 > Hi Olav,
 >
 > Thanks.  That seems to have improved things.
 >
 > I was wondering whether or not there was a way to create one 
PreparedStatement from another.  I have the first one that I've created 
and would like to clone or duplicate this, w/o needing to recompile it.
 >
 > So when I'm using a PreparedStatement, I can set the parameters w/o 
incurring too much of a penalty because it's already compiled?

In order to answer this it would be good to know a bit more about what
you are trying to achieve.  Why do need several prepared statements?
Note that a prepared statement is local to a connection.  If you want
to execute the same statement in another connection, you will have to
prepare it for that connection.  However, Derby has a statement cache
so if the statement is lexically equal to a previous statement, the
result of the previous compilation will be reused, and recompilation
will not be needed.

--
Øystein

Mime
View raw message