基于文档和基于键/值的数据库之间的区别? [英] Difference between Document-based and Key/Value-based databases?

查看:385
本文介绍了基于文档和基于键/值的数据库之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道有三种不同的流行类型的非sql数据库。

I know there are three different, popular types of non-sql databases.


  • 键/值:Redis,Tokyo Cabinet,Memcached

  • ColumnFamily:Cassandra,HBase

  • 文件:MongoDB,CouchDB

我已经阅读了很长的博客,没有理解这么多。

I have read long blogs about it without understanding so much.

我知道关系数据库,并挂起基于文档的数据库,如MongoDB / CouchDB。

I know relational databases and get the hang around document-based databases like MongoDB/CouchDB.

有人能告诉我这些和列表上的前者之间的主要区别是什么?

Could someone tell me what the major differences are between these and the 2 former on the list?

推荐答案

主要区别是数据模型和查询功能。

The main differences are the data model and the querying capabilities.

第一种类型非常简单,可能不需要任何进一步的解释。

The first type is very simple and probably doesn't need any further explanation.

虽然有关于Cassandra等数据库的正确名称的一些争论,我想称它们为 column-family stores 。虽然键值对是Cassandra的一个重要组成部分,但并不仅限于此。它允许你嵌套键值对,所以一个键可以引用多个子键值对。

Although there is some debate on the correct name for databases such as Cassandra, I'd like to call them column-family stores. Although key-value pairs are an essential part of Cassandra, it's not limited to just that. It allows you to nest key-value pairs, so a key could refer to multiple sub-key-value pairs.

你不能无限期地嵌套键值对。您的限制为三个级别(列族)或四个级别的嵌套(超级列族)。如果术语列族不响铃,请参阅 WTF是一个SuperColumn 文章,它是一个很好的解释Cassandra的数据模型。

You cannot nest key-value pairs indefinitely though. Your limited to three levels (column families) or four levels of nesting (super-column families). In case the term column family doesn't ring a bell, see the WTF is a SuperColumn article, it's a good explanation of Cassandra's data model.

文档数据库,如CouchDB MongoDB以 JSON对象的形式存储整个文档。您可以将这些对象视为嵌套的键值对。与Cassandra不同,您可以根据需要嵌套键值对。 JSON还支持数组,并且了解不同的数据类型,例如字符串,数字和布尔值。

Document databases, such as CouchDB and MongoDB store entire documents in the form of JSON objects. You can think of these objects as nested key-value pairs. Unlike Cassandra, you can nest key-value pairs as much as you want. JSON also supports arrays and understands different data types, such as strings, numbers and boolean values.

我相信列族存储只能通过key查询,或通过写map-reduce函数。您不能像在SQL数据库中那样查询值。如果您的应用程序需要更复杂的查询,您的应用程序将必须创建和维护索引才能访问所需的数据。

I believe column-family stores can only be queried by key, or by writing map-reduce functions. You cannot query the values like you would in an SQL database. If your application needs more complex queries, your application will have to create and maintain indexes in order to access the desired data.

文档数据库支持按键和map-reduce功能,还允许您通过值进行基本查询,例如给我所有用户的帖子超过10个。文档数据库以这种方式更灵活。

Document databases support queries by key and map-reduce functions as well, but also allow you to do basic queries by value, such as "Give me all users with more than 10 posts". Document databases are more flexible in this way.

这篇关于基于文档和基于键/值的数据库之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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