SQL (MySQL) 与 NoSQL (CouchDB)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2559411/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 15:41:17  来源:igfitidea点击:

SQL (MySQL) vs NoSQL (CouchDB)

mysqlsqlnosqlcouchdb

提问by christophmccann

I am in the middle of designing a highly-scalable application which must store a lot of data. Just for example it will store lots about users and then things like a lot of their messages, comments etc. I have always used MySQL before but now I am minded to try something new like couchdb or similar which is not SQL.

我正在设计一个必须存储大量数据的高度可扩展的应用程序。举个例子,它会存储很多关于用户的信息,然后是他们的很多消息、评论等。我以前一直使用 MySQL,但现在我想尝试一些新的东西,比如 couchdb 或类似的东西,而不是 SQL。

Does anyone have any thoughts or guidance on this?

有没有人对此有任何想法或指导?

回答by Franci Penov

Here's a quote from a recent blog post from Dare Obasanjo.

这是Dare Obasanjo近期博客文章中的引述。

SQL databases are like automatic transmission and NoSQL databases are like manual transmission. Once you switch to NoSQL, you become responsible for a lot of work that the system takes care of automatically in a relational database system. Similar to what happens when you pick manual over automatic transmission. Secondly, NoSQL allows you to eke more performance out of the system by eliminating a lot of integrity checks done by relational databases from the database tier. Again, this is similar to how you can get more performance out of your car by driving a manual transmission versus an automatic transmission vehicle.

However the most notable similarity is that just like most of us can't really take advantage of the benefits of a manual transmission vehicle because the majority of our driving is sitting in traffic on the way to and from work, there is a similar harsh reality in that most sites aren't at Google or Facebook's scale and thus have no need for a Bigtable or Cassandra.

SQL数据库就像自动传输,NoSQL数据库就像手动传输。一旦您切换到 NoSQL,您就需要负责系统在关系数据库系统中自动处理的大量工作。类似于当您选择手动而不是自动变速箱时会发生什么。其次,NoSQL 允许您通过从数据库层中消除关系数据库执行的大量完整性检查来提高系统的性能。同样,这类似于通过驾驶手动变速箱与自动变速箱车辆来获得更多性能的汽车。

然而,最显着的相似之处是,就像我们大多数人无法真正利用手动变速器车辆的好处一样,因为我们大部分的驾驶都是在上下班途中遇到交通堵塞一样,也有类似的严酷现实因为大多数网站都没有 Google 或 Facebook 的规模,因此不需要 Bigtable 或 Cassandra。

To which I can add only that switching from MySQL, where you have at least some experience, to CouchDB, where you have no experience, means you will have to deal with a whole new set of problems and learn different concepts and best practices. While by itself this is wonderful (I am playing at home with MongoDB and like it a lot), it will be a cost that you need to calculate when estimating the work for that project, and brings unknown risks while promising unknown benefits. It will be very hard to judge if you can do the project on time and with the quality you want/need to be successful, if it's based on a technology you don't know.

我只能补充一点,从 MySQL(您至少有一些经验)到 CouchDB(您没有经验)的转换意味着您将不得不处理一系列全新的问题并学习不同的概念和最佳实践。虽然这本身很棒(我在家里玩 MongoDB 并且非常喜欢它),但在估算该项目的工作时需要计算成本,并且带来未知风险,同时承诺未知收益。如果项目基于您不知道的技术,那么很难判断您是否可以按时完成项目并以您想要/需要的质量获得成功。

Now, if you have on the team an expert in the NoSQL field, then by all means take a good look at it. But without any expertise on the team, don't jump on NoSQL for a new commercial project.

现在,如果您的团队中有 NoSQL 领域的专家,那么一定要好好看看它。但是在团队中没有任何专业知识的情况下,不要在新的商业项目中使用 NoSQL。

Update: Just to throw some gasoline in the open fire you started, here are two interesting articles from people on the SQL camp. :-)

更新:只是为了在你开始的明火中撒些汽油,这里有两篇来自 SQL 阵营人员的有趣文章。:-)

I Can't Wait for NoSQL to Die(original article is gone, here's a copy)
Fighting The NoSQL Mindset, Though This Isn't an anti-NoSQL Piece
Update: Well here is an interesting article about NoSQL
Making Sense of NoSQL

我不能等待的NoSQL到模具(原创文章已经一去不复返了,这里有一个副本
战斗的NoSQL的心态,虽然这不是一个反的NoSQL片
更新:那么这里是关于NoSQL的一个有趣的文章
制作的NoSQL意识

回答by Doron Levari

Seems like only real solutions today revolve around scaling out or sharding. All modern databases (NoSQLs as well as NewSQLs) support horizontal scaling right out of the box, at the database layer, without the need for the application to have sharding code or something.

似乎今天只有真正的解决方案围绕扩展或分片。所有现代数据库(NoSQL 和 NewSQL)都支持在数据库层开箱即用的水平扩展,而无需应用程序具有分片代码或其他东西。

Unfortunately enough, for the trusted good-old MySQL, sharding is not provided "out of the box". ScaleBase(disclaimer: I work there) is a maker of a complete scale-out solution an "automatic sharding machine" if you like. ScaleBae analyzes your data and SQL stream, splits the data across DB nodes, and aggregates in runtime – so you won't have to! And it's free download.

不幸的是,对于值得信赖的老式 MySQL,没有提供“开箱即用”的分片。ScaleBase(免责声明:我在那里工作)是一个完整的横向扩展解决方案的制造商,如果您愿意,它是“自动分片机”。ScaleBae 分析您的数据和 SQL 流,在数据库节点之间拆分数据,并在运行时聚合——因此您不必这样做!而且它是免费下载的。

Don't get me wrong, NoSQLs are great, they're new, new is more choice and choice is always good!! But choosing NoSQL comes with a price, make sure you can pay it...

不要误会我的意思,NoSQL 很棒,它们是新的,新的选择更多,选择总是好的!!但是选择 NoSQL 是有代价的,请确保您可以支付它...

You can see here some more data about MySQL, NoSQL...: http://www.scalebase.com/extreme-scalability-with-mongodb-and-mysql-part-1-auto-sharding

你可以在这里看到更多关于 MySQL、NoSQL 的数据......:http: //www.scalebase.com/extreme-scalability-with-mongodb-and-mysql-part-1-auto-sharding

Hope that helped.

希望有所帮助。

回答by Kiranmai Harshi

One of the best options is to go for MongoDB(NOSql dB) that supports scalability.Stores large amounts of data nothing but bigdata in the form of documents unlike rows and tables in sql.This is fasters that follows sharding of the data.Uses replicasets to ensure data guarantee that maintains multiple servers having primary db server as the base. Language independent. Flexible to use

最好的选择之一是选择支持可扩展性的 MongoDB(NOSql dB)。与 sql 中的行和表不同,以文档的形式存储大量数据,除了大数据之外,这是数据分片之后的更快。使用副本集确保数据保证维护多台以主数据库服务器为基础的服务器。语言独立。使用灵活