Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

100% in-memory HSQL database

I have a Java application set up as a service to do data-mining against ~3GB of data every few hours. I would like this to occur 100% in memory. Ideally I want the application to be isolated from everything; I want it to construct the database, do the mining I need, and tear down the database when it's done.

However with HSQLDB, even when i use the "create memory table...." command, a log is written of all of the statements and the table is recreated the next time the application runs.

I'm doing a LOT of inserts, ~150k+, so this file will quickly grow in size. I also don't care about reconstructing the database upon next run, so the logging is useless to me.

I could just delete the file when I'm done, but if possible I'd like to avoid having to write that much to the disk.

Is there a way to turn off this feature?

Thanks in advance!

like image 896
Alex Beardsley Avatar asked Oct 14 '08 00:10

Alex Beardsley


People also ask

Is Hsql in-memory database?

HSQLDB (HyperSQL DataBase) is the leading SQL relational database system written in Java. It offers a small, fast multithreaded and transactional database engine with in-memory and disk-based tables and supports embedded and server modes.

What does memory database mean?

In-memory databases are purpose-built databases that rely primarily on memory for data storage, in contrast to databases that store data on disk or SSDs. In-memory data stores are designed to enable minimal response times by eliminating the need to access disks.

What does H in HSQLDB stand for?

HSQLDB (Hyper SQL Database) is a relational database management system written in Java. It has a JDBC driver and supports a large subset of SQL-92, SQL:2008, SQL:2011, and SQL:2016 standards.


1 Answers

No problem, just open the database connection thus:

 Connection c = DriverManager.getConnection("jdbc:hsqldb:mem:aname", "sa", "");

For more information, refer to the HSQL docs.

like image 90
Jason Cohen Avatar answered Oct 13 '22 01:10

Jason Cohen