在一个项目中同时使用Mongodb和Mysql [英] Using both Mongodb and Mysql in one project

查看:1816
本文介绍了在一个项目中同时使用Mongodb和Mysql的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在有效学习Mongodb一周,以便用于我的项目.在我的项目中,我将存储大量的地理位置数据,我认为Mongodb最适合存储此信息.此外,速度对我来说非常重要,Mongodb的响应速度比Mysql快.

I have been working to learn Mongodb effectively for one week in order to use for my project. In my project, I will store a huge geolocation data and I think Mongodb is the most appropriate to store this information. In addition, speed very important for me and Mongodb responds faster than Mysql.

但是,我将在项目的某些部分使用一些联接,并且不确定是否将用户信息存储在Mongodb中.我听说在编写过程中mongodb中可能会发生一些问题.我应该只使用mongodb的集合(而不是联接)还是两者都使用?

However, I will use some joins for some parts of the project, and I'm not sure whether I store user's information in Mongodb or not. I heard some issues can occur in mongodb during writing process. should I use only mongodb with collections (instead of join) or both of them?

推荐答案

在大多数情况下,如果项目规模不大,我建议为该项目选择一个数据库.在真正的大型项目(或一般企业)上,我认为长期组织将使用

In most situations I would recommend choosing one db for a project, if the project is not huge. On really big projects (or enterprises in general), I think long term organizations will use a combination of

  • 用于高度事务性OLTP的RDBMS
  • NoSQL
  • 数据仓库/BI项目

但是对于范围更合理的事情,只需选择一个用例核心,然后将其用于所有用途即可.

But for things of more reasonable scope, just pick the one that does the core of the use case, and use it for everything.

在mongodb中存储用户数据的IMO很好-您可以在单个BSON文档上执行原子操作,因此可以执行原子地分配此用户名"之类的操作.使用重做日志( --journal )(v1.8 +),复制,奴隶制复制,可以实现相当高的数据安全性-和纸上的其他db产品一样高.反对安全性的主要论点是产品是新产品,而旧软件总是更安全.

IMO storing user data in mongodb is fine -- you can do atomic operations on single BSON documents so operations like "allocate me this username atomically" are doable. With redo logs (--journal) (v1.8+), replication, slavedelayed replication, it is possible to have a pretty high degree of data safety -- as high as other db products on paper. The main argument against safety would be the product is new and old software is always safer.

如果您需要进行非常复杂的ACID交易(例如记帐),请使用RDBMS.

If you need to do very complex ACID transactions -- such as accounting -- use an RDBMS.

此外,如果您需要执行大量报告,那么mysql可能会更好,特别是如果数据集适合一台服务器. SQL GROUP BY语句非常强大.

Also if you need to do a lot of reporting, mysql may be better at the moment, especially if the data set fits on one server. The SQL GROUP BY statement is quite powerful.

这篇关于在一个项目中同时使用Mongodb和Mysql的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆