1

I am looking for a main memory database with a C++ interface. I am looking for a database with a programmatic query interface and preferably one that works with native C++ types. SQLLite, for example, takes queries as string and needs to perform parsing ... which is time consuming. The operations I am looking for are:

  • Creation of tables of arbitrary dimensions (number of attributes) capable of storing integer types.
  • Support for insertion, deletion, selection, projection and (not a priority) joins.
N 1.1
  • 12,418
  • 6
  • 43
  • 61
myahya
  • 3,079
  • 7
  • 38
  • 51

3 Answers3

1

The parsing time of SQLite isn't really that much (you can amortize it over many queries) unless you're substituting the values into the SQL query by hand. Substituting by hand is hard work, awkward, slow and probably unsafe too. Instead, you should be using bound parameters so that you can do things more directly (see http://www.sqlite.org/c3ref/bind_blob.html for the relevant API).

Note that if you switch to a different database, you will have the same issue; you only get high speed out of any SQL system by using bound parameters. (And consider not sweating over performance too much; the bits where it hits storage are the bottleneck…)

Donal Fellows
  • 133,037
  • 18
  • 149
  • 215
0

Try Boost.MultiIndex.

Marcelo Cantos
  • 181,030
  • 38
  • 327
  • 365
0

BerkeleyDB (now owned by Oracle) can store data entirely in memory (though it was originally designed for disk storage). TimesTen (now also owned by Oracle) was designed from the beginning for in-memory storage. Both of them support both SQL and an API for direct access from C, C++, etc.

Jerry Coffin
  • 476,176
  • 80
  • 629
  • 1,111