views:

113

answers:

6

I have an analytics database where I make complex queries. Each of these queries generates thousands of rows. I want to store these results in some kind of on disk cache so I can get the results later on. I can't insert the results back into the database where the results came from as that database is read only. The requirements of this cache are.

  • Very very fast to insert rows. MySQL is a non-starter.
  • Fast to filter and sort the results
  • No multi-table joins required
  • No transactions

I'm interested to hear of any SQL or NoSQL solutions that can help with this.

+2  A: 

Have you looked at SQLite? It's used by apps ( i.e. Thunderbird, FF ) when they need query power, but not a full-fledged relational database, amongst other uses.

SQLite only provides a single insert command and thus is somewhat worse than MySQL which provides a multi-row insert command.
bradgonesurfing
Wow, good to know.
+1  A: 

You should probably take a look at NoSQL solutions. Maybe Cassandra, http://cassandra.apache.org/ which is used by facebook and digg among others

Vidar Nordnes
A: 

If you have lots of RAM, might want to try the SQLite in-memory database: http://www.sqlite.org/inmemorydb.html

With less RAM, try SQLite temporary databases (further down the page - see hyperlink above). These also use the in-memory cache but parts might be flushed to disk if the database becomes large.

Ashwin Phatak
A: 

Had you considered just writing the rows to files? Log at high speed, analyze at leisure.

Adrian
Yeah but then he'd have to write his own query engine. With SQL he wouldn't be re-inventing the wheel.
A: 

You should also take a look at Advantage database. The local server is free and it supports both SQL and non-SQL solutions. The non-SQL solution will certainly be faster than the SQL approach. The table can be designated as cached so it will stay in memory as long as possible for fast insertion. Advantage Database Server

Alex W
+1  A: 

You didn't specify the platform, but on Windows you can use the built-in Esent database engine. It would provide data persistence with sorting and high performance.

Laurion Burchall