> It is observed that, if derby database runs continuously for say around 5 hrs. > It becomes really slow for further queries even with fresh DB calls.
Unless you are adding data dramatically fast, I don't think you should need to do cleanup or maintenance on the database itself very frequently. I've seen Derby systems (well-tuned ones) run for weeks or months of constant use without slowing down noticeably. If it slows down noticeably in just 5 hours, that sounds like a memory leak of some sort. Perhaps you are not closing your connection or statement or result set objects in a timely fashion, and the garbage collector is having to work very hard to find objects that can be reclaimed? The next time the system is running quite slowly, try gathering some information from it. For example, you can use a tool like VisualVM to see some overall information such as how much CPU you're using, how much memory you're using, how much of the memory is free, how many threads you have, etc. Also, try taking a memory dump of the running system, then analyze it with a tool like the Eclipse Memory Analysis Tool and get a histogram of the memory contents. If you can give the list some more information, such as what is the breakdown of the most-used object types in memory, and what the overall system looks like and is doing during the slowdown, I'm sure people can offer more specific suggestions. thanks, bryan