为什么我应该使用基于文档的数据库,如CouchDB,而不是使用关系数据库。 在哪些典型的应用程序或领域中,基于文档的数据库比关系数据库更适合?
当前回答
基于文档的数据库比关系数据库有一个很大的优势,因为它们不需要预先定义模式——在能够输入任何数据之前。
此外,如果您的数据不是关系型的,不能存储在表中,而是一组图像,或例如报纸文章,则应该使用文档数据库。
另一个优点是易于在web开发中使用基于文档的数据库。 要了解更多深入的NoSQL数据库模型比较,请查看这个来源:https://arxiv.org/ftp/arxiv/papers/1509/1509.08035.pdf
其他回答
一个原因是对不一定具有相同结构/模式的JSON(或其他自描述格式)文档提供快速全文搜索。
来自CouchDB文档(https://web.archive.org/web/20090122111651/http://couchdb.apache.org/docs/overview.html):
"A document database server, accessible via a RESTful JSON API." Generally, relational databases aren't simply accessed via REST services, but require a much more complex SQL API. Often these API's (JDBC, ODBC, etc.) are quite complex. REST is quite simple. Ad-hoc and schema-free with a flat address space. Relational databases have complex, fixed schema. You define tables, columns, indexes, sequences, views and other stuff. Couch doesn't require this level of complex, expensive, fragile advanced planning. Distributed, featuring robust, incremental replication with bi-directional conflict detection and management. Some SQL commercial products offer this. Because of the SQL API and the fixed schemas, this is complex, difficult and expensive. For Couch, it appears simple and inexpensive. Query-able and index-able, featuring a table oriented reporting engine that uses Javascript as a query language. So does SQL and relational databases. Nothing new here.
所以。为什么CouchDB ?
REST比JDBC或ODBC更简单。 没有图式比图式更简单。 以一种看起来简单而廉价的方式分布。
详细说明smdelfin:灵活性。您可以以任何结构(非结构化和全部)存储数据,并且每个文档都可以完全不同。CouchDB特别有用,因为通过它们的“视图”索引,您可以过滤掉特定的文档,并在需要数据库的那些子集时只查询该视图。
对于以JSON格式存储数据的文档数据库,我最大的优势在于:这是JavaScript的原生格式。因此,JavaScript web应用程序与CouchDB一起工作得非常好。我最近开发了一个利用CouchDB的web应用程序,它的速度非常快,同时还能够处理不断变化的数据结构。
也许你不应该:-)
The second most obvious answer is you should use it if your data isn't relational. This usually manifests itself in having no easy way to describe your data as a set of columns. A good example is a database where you actually store paper documents, e.g. by scanning office mail. The data is the scanned PDF and you have some meta data which always exists (scanned at, scanned by, type of document) and lots of possible metadata fields which exists sometime (customer number, supplier number, order number, keep on file until, OCRed fulltext, etc). Usually you do not know in advance which metadata fields you will add within the next two years. Things like CouchDB work much nicer for that kind of data than relational databases.
我个人还喜欢这样一个事实:除了HTTP客户端之外,CouchDB不需要任何客户端库,现在几乎每一种编程语言都包含了HTTP客户端。
可能最不明显的答案是:如果使用RDBMS没有痛苦,那么就继续使用它。如果您总是要绕过RDBMS来完成工作,那么面向文档的数据库可能值得一试。
想要更详细的列表,请查看理查德·琼斯的这篇帖子。
基于文档的数据库比关系数据库有一个很大的优势,因为它们不需要预先定义模式——在能够输入任何数据之前。
此外,如果您的数据不是关系型的,不能存储在表中,而是一组图像,或例如报纸文章,则应该使用文档数据库。
另一个优点是易于在web开发中使用基于文档的数据库。 要了解更多深入的NoSQL数据库模型比较,请查看这个来源:https://arxiv.org/ftp/arxiv/papers/1509/1509.08035.pdf
推荐文章
- 为什么我应该使用基于文档的数据库而不是关系数据库?
- 哪个更快/最好?SELECT *或SELECT columnn1, colum2, column3等
- 将值从同一表中的一列复制到另一列
- 什么是数据库池?
- 关于数据库,每个开发人员应该知道些什么?
- "where 1=1"语句
- 是使用各有一个模式的多个数据库更好,还是使用一个数据库有多个模式更好?
- 如何从Oracle的表中获取列名?
- 如何检查表上持有哪些锁
- 在MongoDB中查找重复的记录
- 模式、表和数据库之间的区别是什么?
- 我看到VARCHAR(255)如此频繁地使用(而不是其他长度),有什么好的原因吗?
- 使用pgadmin连接到heroku数据库
- Delete_all vs destroy_all
- 我如何移动一个redis数据库从一个服务器到另一个?