Thomas replied to my query:
David Leader wrote:
While I mention this, could I perhaps raise the remaining speed
problem. I made a Derby database with one table, two fields and
two tuples (can't get much smaller) and am running it unzipped
from a java app that has the simplest gui with a menu with the two
fields as menu items and a text area for results. After the GUI
has opened the first query takes perhaps five or ten seconds,
whereas the subsequent ones are 'instantaneous'. Anyone know why?
David,
My initial guess is those few seconds on the first query are your
initialization cost - that is, starting the derby engine (if
embedded), loading the driver and setting up the jdbc connection,
and then getting the first statement through.
On a small db, five secs sounds like a lot - but still very possible.
Does it take that long to start if you use ij as well? Does it make
a difference wether you run embedded or not?
Using ij it certainly doesn't take as long, but there is a
perceptable lag before the database connection is made, and the first
time a query is made it is perceptably slower than the second time -
perhaps just a second compared with apparently instantaneous. I
haven't done anything in a non-embedded setup, but I guess you are
right and it's something one just has to live with. Despite a few
problems in porting the stuff from MySQL, I must say that overall I'm
very pleased with the result. My thanks to the Derby team.
(Although my son says I should be using SQLite because Google is
using that for Gears. Sigh.)
David