database NoSql 与关系数据库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4160732/
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-09-08 07:54:52  来源:igfitidea点击:

NoSql vs Relational database

databasedatabase-designnosqlrelational-databaserdbms

提问by user496949

Recently NoSQLhas gained immense popularity.

最近NoSQL获得了极大的欢迎。

What are the advantages of NoSQLover traditional RDBMS?

NoSQL与传统RDBMS相比有哪些优势?

采纳答案by duffymo

Not all data is relational. For those situations, NoSQL can be helpful.

并非所有数据都是关系数据。对于这些情况,NoSQL 会有所帮助。

With that said, NoSQL stands for "Not Only SQL". It's not intended to knock SQL or supplant it.

话虽如此,NoSQL 代表“不仅是 SQL”。它并不是要敲打 SQL 或取代它。

SQL has several very big advantages:

SQL有几个非常大的优点:

  1. Strong mathematical basis.
  2. Declarative syntax.
  3. A well-known language in Structured Query Language (SQL).
  1. 强大的数学基础。
  2. 声明式语法。
  3. 结构化查询语言 (SQL) 中的一种众所周知的语言。

Those haven't gone away.

那些还没有消失。

It's a mistake to think about this as an either/or argument. NoSQL is an alternative that people need to consider when it fits, that's all.

将此视为非此即彼的论点是错误的。NoSQL 是人们在合适时需要考虑的替代方案,仅此而已。

Documents can be stored in non-relational databases, like CouchDB.

文档可以存储在非关系型数据库中,例如 CouchDB。

Maybe reading thiswill help.

也许阅读本文会有所帮助。

回答by I GIVE CRAP ANSWERS

The history seem to look like this:

历史似乎是这样的:

  1. Google needs a storage layer for their inverted search index. They figure a traditional RDBMS is not going to cut it. So they implement a NoSQL data store, BigTable on top of their GFS file system. The major part is that thousands of cheap commodity hardware machines provides the speed and the redundancy.

  2. Everyone else realizes what Google just did.

  3. Brewers CAP theoremis proven. All RDBMS systems of use are CA systems. People begin playing with CP and AP systems as well. K/V storesare vastly simpler, so they are the primary vehicle for the research.

  4. Software-as-a-service systems in general do not provide an SQL-like store. Hence, people get more interested in the NoSQL type stores.

  1. 谷歌需要一个存储层来存储倒排搜索索引。他们认为传统的 RDBMS 不会削减它。因此,他们在 GFS 文件系统之上实现了 NoSQL 数据存储 BigTable。主要部分是数以千计的廉价商品硬件机器提供速度和冗余。

  2. 其他人都意识到谷歌刚刚做了什么。

  3. Brewers CAP 定理得到证明。所有使用的 RDBMS 系统都是 CA 系统。人们也开始玩 CP 和 AP 系统。K/V 存储要简单得多,因此它们是研究的主要工具。

  4. 软件即服务系统通常不提供类似 SQL 的存储。因此,人们对 NoSQL 类型的存储更感兴趣。

I think much of the take-off can be related to this history. Scaling Google took some new ideas at Google and everyone else follows suit because this is the only solution they know to the scaling problem right now. Hence, you are willing to rework everything around the distributed database idea of Google because it is the only way to scale beyond a certain size.

我认为大部分起飞都与这段历史有关。扩展 Google 在 Google 采纳了一些新想法,其他人也纷纷效仿,因为这是他们目前知道的唯一解决扩展问题的方法。因此,您愿意围绕 Google 的分布式数据库理念重新设计所有内容,因为这是扩展到特定规模之外的唯一方法。

C - Consistency
A - Availability
P - Partition tolerance
K/V - Key/Value

C - 一致性
A - 可用性
P - 分区容错
K/V - 键/值

回答by Ravindra babu

NoSQL is better than RDBMS because of the following reasons/properities of NoSQL

NoSQL 比 RDBMS 好,因为 NoSQL 的以下原因/特性

  1. It supports semi-structured data and volatile data
  2. It does not have schema
  3. Read/Write throughput is very high
  4. Horizontal scalability can be achieved easily
  5. Will support Bigdata in volumes of Terra Bytes & Peta Bytes
  6. Provides good support for Analytic tools on top of Bigdata
  7. Can be hosted in cheaper hardware machines
  8. In-memory caching option is available to increase the performance of queries
  9. Faster development life cycles for developers
  1. 支持半结构化数据和易失性数据
  2. 它没有架构
  3. 读/写吞吐量非常高
  4. 可以轻松实现水平扩展
  5. 将支持大数据量的 Terra Bytes 和 Peta Bytes
  6. 为大数据之上的分析工具提供良好的支持
  7. 可以托管在更便宜的硬件机器上
  8. 内存缓存选项可用于提高查询性能
  9. 为开发人员提供更快的开发生命周期

EDIT:

编辑:

To answer "why RDBMS cannot scale", please take a look at RDBMS Overheadspdf written by Stavros Harizopoulos,Daniel J. Abadi,Samuel Madden and Michael Stonebraker

要回答“为什么 RDBMS 无法扩展”,请查看由 Stavros Harizopoulos、Daniel J. Abadi、Samuel Madden 和 Michael Stonebraker 编写的RDBMS Overheadspdf

RDBMS's have challenges in handling huge data volumes of Terabytes & Peta bytes. Even if you have Redundant Array of Independent/Inexpensive Disks (RAID) & data shredding, it does not scale well for huge volume of data. You require very expensive hardware.

RDBMS 在处理 TB 和 Peta 字节的海量数据方面面临挑战。即使您有独立/廉价磁盘冗余阵列 (RAID) 和数据粉碎,它也不能很好地扩展以处理大量数据。您需要非常昂贵的硬件。

Logging:Assembling log records and tracking down all changes in database structures slows performance. Logging may not be necessary if recoverability is not a requirement or if recoverability is provided through other means (e.g., other sites on the network).

日志记录组合日志记录并跟踪数据库结构中的所有更改会降低性能。如果可恢复性不是必需的,或者如果可恢复性是通过其他方式(例如,网络上的其他站点)提供的,则可能不需要日志记录。

Locking: Traditional two-phase locking poses a sizeable overhead since all accesses to database structures are governed by a separate entity, the Lock Manager.

锁定:传统的两阶段锁定带来了相当大的开销,因为对数据库结构的所有访问都由单独的实体锁管理器管理。

Latching: In a multi-threaded database, many data structures have to be latched before they can be accessed. Removing this feature and going to a single-threaded approach has a noticeable performance impact.

锁存:在多线程数据库中,许多数据结构必须先锁存才能访问。删除此功能并采用单线程方法会对性能产生显着影响。

Buffer management: A main memory database system does not need to access pages through a buffer pool, eliminating a level of indirection on every record access.

缓冲区管理:主内存数据库系统不需要通过缓冲池访问页面,消除了每次记录访问的间接级别。

This does not mean that we have to use NoSQL over SQL.

这并不意味着我们必须在 SQL 上使用 NoSQL。

Still, RDBMS is better than NoSQL for the following reasons/properties of RDBMS

尽管如此,由于 RDBMS 的以下原因/特性,RDBMS 还是比 NoSQL 好

  1. Transactions with ACIDproperties - Atomicity, Consistency, Isolation & Durability
  2. Adherence to Strong Schemaof data being written/read
  3. Real time query management( in case of data size < 10 Tera bytes )
  4. Execution of complex queries involving join & group by clauses
  1. 具有ACID属性的事务- 原子性、一致性、隔离性和持久性
  2. 遵守正在写入/读取的数据的强模式
  3. 实时查询管理(在数据大小< 10 Tera 字节的情况下)
  4. 执行涉及join 和 group by 子句的复杂查询

We have to use RDBMS (SQL) and NoSQL (Not only SQL) depending on the business case & requirements

我们必须根据业务案例和要求使用 RDBMS (SQL) 和 NoSQL(不仅是 SQL)

回答by nvogel

NOSQL has no special advantages over the relational database model. NOSQL does address certain limitations of current SQL DBMSs but it doesn't imply any fundamentally new capabilities over previous data models.

与关系数据库模型相比,NOSQL 没有特别的优势。NOSQL 确实解决了当前 SQL DBMS 的某些限制,但它并不意味着比以前的数据模型具有任何根本性的新功能。

NOSQL means only no SQL(or "not only SQL") but that doesn't mean the same as no relational. A relational database in principle would make a very good NOSQL solution - it's just that none of the current set of NOSQL products uses the relational model.

NOSQL 意味着只有没有SQL(或“不仅是 SQL”),但这并不意味着与没有关系的. 原则上,关系数据库将是一个非常好的 NOSQL 解决方案——只是当前的 NOSQL 产品集都没有使用关系模型。

回答by suiwenfeng

RDBMSfocus more on relationship and NoSQLfocus more on storage.

RDBMS更关注关系,NoSQL更关注存储。

You can consider using NoSQLwhen your RDBMSreaches bottlenecks. NoSQLmakes RDBMSmore flexible.

当您的RDBMS遇到瓶颈时,您可以考虑使用NoSQLNoSQL使RDBMS更加灵活。

回答by Jon

The biggest advantage of NoSQL over RDBMS is Scalability.
NoSQL databases can easily scale-out to many nodes, but for RDBMS it is very hard.
Scalability not only gives you more storage space but also much higher performance since many hosts work at the same time.

NoSQL 相对于 RDBMS 的最大优势是可扩展性
NoSQL 数据库可以轻松扩展到多个节点,但对于 RDBMS 来说却非常困难。
由于许多主机同时工作,可扩展性不仅为您提供更多的存储空间,而且还提供更高的性能。

回答by Chris

If you need to process huge amount of data with high performance

如果您需要高性能处理海量数据

OR

或者

If data model is not predetermined

如果数据模型不是预先确定的

then

然后

NoSQL database is a better choice.

NoSQL 数据库是更好的选择。

回答by Manvendra Jina

Just adding to all the information given above

只需添加上面给出的所有信息

NoSql Advantages:

NoSql 优势:

1) NoSQL is good if you want to be production ready fast due to its support for schema-less and object oriented architecture.

1) 由于 NoSQL 支持无模式和面向对象的体系结构,因此如果您想快速准备好生产,它是很好的选择。

2) NoSql db's are eventually consistent which in simple language means they will not provide any lock on the data(documents) as in case of RDBMS and what does it mean is latest snapshot of data is always available and thus increase the latency of your application.

2)NoSql db 最终是一致的,用简单的语言来说,这意味着它们不会像 RDBMS 那样对数据(文档)提供任何锁定,这意味着最新的数据快照始终可用,从而增加应用程序的延迟.

3) It uses MVCC (Multi view concurrency control) strategy for maintaining and creating snapshot of data(documents).

3)它使用MVCC(多视图并发控制)策略来维护和创建数据(文档)的快照。

4) If you want to have indexed data you can create view which will automatically index the data by the view definition you provide.

4)如果您想要索引数据,您可以创建视图,该视图将根据您提供的视图定义自动索引数据。

NoSql Disadvantages:

NoSql 的缺点:

1) Its definitely not suitable for big heavy transactional applications as it is eventually consistent and does not support ACID properties.

1)它绝对不适合大型繁重的事务应用程序,因为它最终一致并且不支持 ACID 属性。

2) Also it creates multiple snapshots (revisions) of your data (documents) as it uses MVCC methodology for concurrency control, as a result of which space get consumed faster than before which makes compaction and hence reindexing more frequent and it will slow down your application response as the data and transaction in your application grows. To counter that you can horizontally scale the nodes but then again it will be higher cost as compare sql database.

2)它还创建数据(文档)的多个快照(修订),因为它使用 MVCC 方法进行并发控制,因此空间消耗比以前更快,这使得压缩和因此更频繁地重新索引,它会减慢你的速度随着应用程序中数据和事务的增长,应用程序响应。为了解决这个问题,您可以水平扩展节点,但与比较 sql 数据库相比,它的成本会更高。

回答by deadpool

From mongodb.com:

mongodb.com

NoSQL databases differ from older, relational technology in four main areas:

Data models: A NoSQL database lets you build an application without having to define the schema first unlike relational databases which make you define your schema before you can add any data to the system. No predefined schema makes NoSQL databases much easier to update as your data and requirements change.

Data structure: Relational databases were built in an era where data was fairly structured and clearly defined by their relationships. NoSQL databases are designed to handle unstructured data (e.g., texts, social media posts, video, email) which makes up much of the data that exists today.

Scaling: It's much cheaper to scale a NoSQL database than a relational database because you can add capacity by scaling out over cheap, commodity servers. Relational databases, on the other hand, require a single server to host your entire database. To scale, you need to buy a bigger, more expensive server.

Development model: NoSQL databases are open source whereas relational databases typically are closed source with licensing fees baked into the use of their software. With NoSQL, you can get started on a project without any heavy investments in software fees upfront.

NoSQL 数据库在四个主要方面与旧的关系技术不同:

数据模型:NoSQL 数据库使您无需先定义架构即可构建应用程序,而关系数据库则需要您先定义架构,然后才能向系统添加任何数据。当您的数据和需求发生变化时,没有预定义的架构使 NoSQL 数据库更容易更新。

数据结构:关系数据库建立在数据结构合理且由它们的关系明确定义的时代。NoSQL 数据库旨在处理构成当今大部分数据的非结构化数据(例如,文本、社交媒体帖子、视频、电子邮件)。

扩展:扩展 NoSQL 数据库比扩展关系数据库便宜得多,因为您可以通过扩展廉价的商品服务器来增加容量。另一方面,关系数据库需要一台服务器来托管整个数据库。要扩展,您需要购买更大、更昂贵的服务器。

开发模型:NoSQL 数据库是开源的,而关系数据库通常是闭源的,许可费用包含在其软件的使用中。使用 NoSQL,您可以开始一个项目,而无需在软件费用方面进行任何大量投资。