Search code examples
mongodbmemoryredisrdbmsdatabase

Storage engine for specific case


What database can you recomend for such case:

  1. Very lot of inserts and updates
  2. Sophisticated queries (SQL or something like it)
  3. Lot of data, but small amount of frequently accessed (can be in memory)
  4. It's OK to loose part of data (recent hour for example) in case of crash (but not everything)

Possible solutions and problems with it:

  • Redis - looks good, but it doesn't support complex queries.
  • RDBMS (current solution) - guarantee ACID and use hard disc a lot so updates is too slow
  • RDBMS + RAM disc - will use OS swap, recovery problems, and in general look not very reliable
  • MongoDB - has server level lock on writes, is it really fast?

Solution

  • 1.Very lot of inserts and updates(Mobgodb).

    4.It's OK to loose part of data (recent hour for example) in case of crash (but not everything)

    Optional asynchronous writes in mongo will help with speed here. Speed of insert/write in mongodb will faster than sql because mongo write all data in memory first and mongodb does not use transactions.

    2.Sophisticated queries (SQL or something like it)

    If you have a lot of hard reports that require join almost all data better use sql here. But if you need hard queries inside of document use mongodb(depend from sql/nosql db schema design)

    3.Lot of data, but small amount of frequently accessed (can be in memory)

    If enough free memory on the server mongodb load all data into RAM.

    Because of i mongodb fanatic i will choose MongoDb, but without specific task cann't be sure that choose will be right. Also i've compared only sql and mongodb, because i am not used Redis at all.