I have used h2 as cache for analytics query. This is working very well. Things to consider
- manage connection pool and make sure you keep atleast 1 open
- when doing changes use copy on write pattern to avoid any slowness on read query. Disk are very cheap!
- disable all the index before large insert and enable it again.
- choose your index based on read access pattern
- compact database after large insert.
- Shard db based on performance requirement.
Using these strategy I am able to manage close to billion records and giving millisecond response time