pawan2009 <[email protected]> writes: > Hi > > We are seeing that occasionally, when our application starts (it uses derby > to store data), derby database can be connected to quickly - but on the very > first query to the database, it takes a long time for derby to come back and > respond. It is as if derby is doing some house work recovering data or > indexing or something. If we let our application run for 20-30 minutes, the > query does complete and after that everything works fine. We see it only > occasionally. > > Any ideas on what could be causing this?
The data recovery performed on startup after an unclean shutdown may take a while to finish if a long-lived transaction has prevented old transaction logs from being deleted. But the recovery should happen when the first connection to the database is opened, not on the first query. It would be interesting if you could get a thread dump (using jstack, VisualVM, or some other tool) when this happens so that we can see where Derby is spending time. -- Knut Anders
