As part of the work for the database search queries project, the project team has proposes to investigate the possibility of enhancing the MMBase connectionpool with a prepared statement cache. The idea is as follows: Reusal of prepared statements offers performence benefits over ordinary statements, because an amount of preparation has to be performed by the database only once. (This preparation involves parsing the query and calculating the optimal strategy for execution.)A prepared statement can only be reused using the same database connection. Because of this, it is generally assumed that prepared statements can not be reused in MMBase, since MMBase does not keep the same connection over a number of database requests.In spite of this, it is possible to reuse connections, since they are usually not closed, but just returned to a connection pool.Using prepared statement caching this can be used to reuse prepared statements as follows:the pool caches prepared statements, and transparently replaces prepared statement calls by calls to cached prepared statements. This relies partly on the fact that the pool can pick the associated connection if it is available. A number of application servers offer this feature, and we feel we should consider it for MMBase as well. Gerard van de Looi from E-id will investigate this further. While it is not a strict requirement for the query project, the project provides a good opportunity and there are some direct benefits.If we can map our SearchQuery objects to prepared statements, it will be easier to reuse the query object themselves, leading to cleaner code and better performance. Rob van Maris Developer
Finalist IT Group Java Specialists ------------------------------------------------------------- Amsterdam, The Netherlands Office: +31 20 5962321 (Direct) Mobile: +31 651444006 Fax: +31 20 5962331 -------------------------------------------------------------
