English 中文(简体)
特定案例的存储引擎
原标题:Storage engine for specific 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)

可能的解决方案和问题:

  • 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?
最佳回答

1.大量的插入和更新(Mobgodb)。

4.在崩溃时丢失部分数据(例如最近一小时)是可以的(但不是所有数据)

mongo中可选的异步写入将有助于提高速度。mongodb中的插入/写入速度将比sql快,因为mongo首先将所有数据写入内存,而mongodb不使用事务。

2.复杂的查询(SQL或类似的东西)

如果你有很多需要联接几乎所有数据的硬报告,最好在这里使用sql。但是,如果您需要文档内部的硬查询,请使用mongodb(取决于sql/nosql-db模式设计)

3.数据量大,但频繁访问的数据量小(可以在内存中)

如果服务器上有足够的可用内存,mongodb会将所有数据加载到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.

问题回答

关系Mysql/Postgresql+分区应该能够解决用例。MongoDb可能是理想的解决方案,但有两个原因。

  • Needs sufficient RAM to ensure that a decent portion of database is in memory.
  • 支持复杂查询。由于不支持JOIN,所以需要在多个位置复制数据,否则必须在应用程序代码中执行JOIN。

  • 复杂分析查询的性能数据聚合mongodb与mysql

有类似的情况,并评估了postgresql与mongodb的比较。由于上述原因,选择了postgresql+分区(分区是在时间戳上完成的)。

如果数据集是按时间顺序排列的,或者如果分区在某种程度上是可能的,那么更新和查询将很快。

对于mysql,如果使用MYISAM(非事务性)存储引擎,性能将以耐久性为代价进一步提高。对于不允许关闭事务的RDBMS,仍然可以通过调整检查点间隔和少数其他参数来提高性能,以确保事务以轻松的方式提交。但是,如果模式可以频繁更改,那么RDBMS解决方案可能会很复杂。

复杂的查询和插入速度现在并没有混合。当然,除非提前知道这些疑问。是吗?





相关问题
what is wrong with this mysql code

$db_user="root"; $db_host="localhost"; $db_password="root"; $db_name = "fayer"; $conn = mysqli_connect($db_host,$db_user,$db_password,$db_name) or die ("couldn t connect to server"); // perform query ...

Users asking for denormalized database

I am in the early stages of developing a database-driven system and the largest part of the system revolves around an inheritance type of relationship. There is a parent entity with about 10 columns ...

Easiest way to deal with sample data in Java web apps?

I m writing a Java web app in my free time to learn more about development. I m using the Stripes framework and eventually intend to use hibernate and MySQL For the moment, whilst creating the pages ...

join across databases with nhibernate

I am trying to join two tables that reside in two different databases. Every time, I try to join I get the following error: An association from the table xxx refers to an unmapped class. If the ...

How can I know if such value exists in database? (ADO.NET)

For example, I have a table, and there is a column named Tags . I want to know if value programming exists in this column. How can I do this in ADO.NET? I did this: OleDbCommand cmd = new ...

Convert date to string upon saving a doctrine record

I m trying to migrate one of my PHP projects to Doctrine. I ve never used it before so there are a few things I don t understand. In my current code, I have a class similar to this: class ...

热门标签