Hey

Aaron Mulder wrote:
> On Thu, 24 Aug 2000, Rickard [iso-8859-1] �berg wrote:
> > ...
> > One thing that needs to be done is pooling of prepared statements. That
> > should easily be added to Minerva I think. Aaron, any thoughts?
> 
>         Sure but...  Minerva treats everything in the pool as identical,
> so you would have to set up different pools for statements with different
> SQL.  Not a biggie.  Also, you'd have to keep the Connections that created
> the PreparedStatements out of the pool - since you wouldn't want someone
> else committing/rolling back - and this could be a resource drain on the
> connection pool.  Also, we'd have to fix the problem with keeping a
> connection checked out during commit/rollbacks - that's pretty easy, but I
> want to be sure we get the theory right first.  Finally, the database
> should really do this for you.  That is, it should cache the query
> analysis so you should get most of the speedup by simply using prepared
> statements, not by caching them.  I'm pretty sure Oracle works this way,
> though I don't know that much about the implementations of Hypersonic,
> Postgres, etc.
>         So I think it's possible, but I think the bang-for-buck is pretty
> low, particularly when you start using a large number of prepared
> statements and beans and you're limited to 255 database connections or
> whatever.

Hm.. I don't follow you here. Cached PreparedStatements are per
Connection, so every connection will have a set of prepared statements,
hence no need to do trickery as you outline above. 

Here's what I propose: in your connection wrapper, on prepareStatement
you simply check a cache against the SQL. If it's there, return it,
otherwise create a new prepared statement, put it in cache, and return
it. Very very simple.

Seems ok? Or am I missing something here...

/Rickard

-- 
Rickard �berg

Email: [EMAIL PROTECTED]
http://www.telkel.com
http://www.jboss.org
http://www.dreambean.com


--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Problems?:           [EMAIL PROTECTED]

Reply via email to