On Sat, Nov 10, 2001 at 04:57:15PM +0100, Thomas Eibner wrote:
> On Sat, Nov 10, 2001 at 02:58:20AM -0600, Bob Tanner wrote:
> > Quoting Thomas Eibner (thomas at stderr.net):
> > > So most of the query gets cached and you gain the benefit of not needing
> > > to quote the input from the user since that automatically happens by the
> > > binding of the placeholders.
> > > 
> > > Does something similar exist in Java?
> > 
> > It's called the prepareStatement() and it works just like the perl stuff. As I
> > posted previous, most modern servlet containers even cache queries for you
> > (don't ask me how it works :-).
> 
> Why would you want your servlet container to cache the queries for you?
> That is the job of the database, and the database only. What if the data
> changed on disk?

Caches the parsed query statement, not the query results.

This might help a great deal when:
   1. you have a very complicated query - I have saw monster queries when
      working on a big financial application
   2. the database can cache the cost estimations for a query. For instance
      a query requires a B*Tree index, a bitmapped index or a full table scan.
      Or the database has some tables clustered in a star-schema. Or ...
      All this knowledge is gathered by the database engine when you prepare
      the query and if that means analysing histograms and usage patterns
      for 5-10 tables, it might take some time.

In a previous life I have developed a mutual fund management application. It
had around 150 tables. The schema was normalized to the 4th form and then
denormalized for performance. But it was big.

Imagine all the financial instruments and variations that exist: stocks, bonds
(and this is a can of worms: fixed bonds, floating bonds, 0-bonds, with/without
coupons, convertible), futures, options, warrants, indices...

florin

-- 

"If it's not broken, let's fix it till it is."

41A9 2BDE 8E11 F1C5 87A6  03EE 34B3 E075 3B90 DFE4
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 230 bytes
Desc: not available
Url : http://shadowknight.real-time.com/pipermail/tclug-list/attachments/20011110/3bcb9f6c/attachment.pgp