views:

111

answers:

2

I need to maintain a 200 entries, 12 column table at extremely high speed, can I simply use boost multiindex to cutoff the sql overhead?

Has anyone ever tried to do this? What are the cons and pros of such a solution?

thanks

+1  A: 

If you no need to use T-SQL and you no need in benefits of full SQL server, then you could use multi_index with no problems. Additionally may be you will want to use custom allocator for your records (pool_allocator or something else).

Kirill V. Lyadvinsky
As an alternative, he could use [interprocess](http://www.boost.org/doc/libs/1_41_0/doc/html/interprocess.html) to build it in a memory mapped file. In that case, there are allocators already made for that purpose, and he has persistence/quick load by default.
rcollyer
+3  A: 

A multi-index container will be much faster than a SQL table under certain circumstances:

  • Small amount of data relative to system memory
  • No need to load/store the container regularly
  • Queries/Indexes are known at compile time
  • You're willing to (or don't need to) handle thread-safety/atomicity

For best performance you will need to set up indexes on any fields you will be searching, obviously. If you need to look at multiple fields use a composite key, since you can't use two separate indexes together.

Tim Sylvester
+1 for pointing out the ACID properties.
Matthieu M.