In short in HSQLDB cached table sucks in terms of performance. To elaborate I was running a program which takes around 9 hours running on two medium sized cached tables (bigger one 163 MB). I changed the tables to memory tables (default) and it now takes less than 10 minutes. Let's see how we can easily convert memory table to cached table and vice-versa.