database 什么是非关系数据库的示例?它们在哪里/如何使用?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/202819/
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
What is an example of a non-relational database? Where/how are they used?
提问by Kip
I have been working with relational databases for sometime, but it only recently occurred to me that there must be other types of databases that are non-relational.
我一直在使用关系数据库,但直到最近我才意识到必须有其他类型的非关系数据库。
What are some examples of non-relational databases, and where/how are they used in the real world? Why would you choose to use a non-relational database over relational databases?
有哪些非关系型数据库的示例,以及它们在现实世界中的位置/方式?为什么选择使用非关系数据库而不是关系数据库?
Edit: Two other similar questions have been mentioned in the answers:
编辑:答案中还提到了另外两个类似的问题:
采纳答案by Michael Burr
- Flat file
- CSV or other delimited data
- spreadsheets
- /etc/passwd
- mbox mail files
- Hierarchical
- Windows Registry
- Subversion using the file system, FSFS, instead of Berkley DB
- 平面文件
- CSV 或其他分隔数据
- 电子表格
- /etc/passwd
- mbox 邮件文件
- 分层的
- Windows 注册表
- Subversion 使用文件系统 FSFS,而不是 Berkley DB
回答by Jeff Jones
An admittedly obscure but interesting alternative to the types of databases mentioned here is the associative database, such as Sentences, from LazySoft Technology. There is a free personal version you can download and try on your own. The Enterprise Edition is also free, but requires a request to the company.
此处提到的数据库类型的一个公认的晦涩但有趣的替代方案是关联数据库,例如来自LazySoft Technology 的Sentences 。有一个免费的个人版本,您可以下载并自行试用。企业版也是免费的,但需要向公司提出请求。
Essentially, an associative database allows you to store information in much the same way as our brains do: as things and associations between those things. The name "Sentences" comes from the way this information can be represented in a subject-verb-objectsyntax:
本质上,关联数据库允许您以与我们的大脑大致相同的方式存储信息:作为事物以及这些事物之间的关联。“Sentences”这个名字来源于这种信息可以用主语-动词-宾语语法表示的方式:
- Tom is brother toLaura
- San Francisco is located inCalifornia
- Mike has a credit limit of$10,000
- 汤姆是劳拉的兄弟
- 旧金山在加利福尼亚州的位置
- Mike的信用额度为 10,000 美元
A sentence may be the subject or object of another sentence:
一个句子可以是另一个句子的主语或宾语:
- (Bus 570 arrives at8:15am) onSundays
- Mary says(the pie was baked byWilliam)
- (公交车570到达上午8:15)上周日
- 玛丽说(馅饼是威廉烤的)
So, everything can be boiled down to entitiesand associations.
所以,一切都可以归结为实体和关联。
There is, of course, much more to Sentences than what can be expressed here. I recommend that you take some time to read more about it in a white paperfrom LazySoft.
当然,Sentences 的内容远不止这里可以表达的内容。我建议您花一些时间在LazySoft的白皮书中阅读更多相关信息。
"The Associative Model of Data"is a book available in PDF format by Simon Williams, one of the creators of Sentences.
“数据的关联模型”是 Sentences 的创建者之一西蒙·威廉姆斯 (Simon Williams) 提供的 PDF 格式的书。
回答by TomC
A non-relational document oriented database we have been looking at is Apache CouchDB.
我们一直在研究的一个非关系文档导向数据库是Apache CouchDB。
Apache CouchDB is a distributed, fault-tolerant and schema-free document-oriented database accessible via a RESTful HTTP/JSON API. Among other features, it provides robust, incremental replication with bi-directional conflict detection and resolution, and is queryable and indexable using a table-oriented view engine with JavaScript acting as the default view definition language.
Apache CouchDB 是一个分布式、容错和无模式的面向文档的数据库,可通过 RESTful HTTP/JSON API 访问。在其他功能中,它提供强大的增量复制和双向冲突检测和解决方案,并且可以使用面向表的视图引擎进行查询和索引,JavaScript 作为默认视图定义语言。
Our interest was in providing a distributed access user preferences store that would be immune to shape changes to which we could serialize preference objects from Java and access those just as easily with Javascript from a XULRunner based client application.
我们的兴趣是提供一个分布式访问用户首选项存储,它不受形状更改的影响,我们可以从 Java 序列化首选项对象,并使用基于 XULRunner 的客户端应用程序中的 Javascript 轻松访问这些对象。
回答by FlySwat
Any database that claims to be a "Berkley style Database" or "Key/Value" Database is not relational.
任何声称是“伯克利式数据库”或“键/值”数据库的数据库都不是关系型数据库。
These databases are usually based off complex hashing algorithms and provide a very fast lookup O(1) based off a key, but leave any form of relational goodness to end user.
这些数据库通常基于复杂的散列算法,并提供基于键的非常快速的查找 O(1),但将任何形式的关系优势留给最终用户。
For example, in a relational database, you would normalize your structure and join many tables together to create a single result set.
例如,在关系数据库中,您将规范化您的结构并将许多表连接在一起以创建单个结果集。
In a key/value database, you would denormalize as much as possible and then use a unique key to lookup data.
在键/值数据库中,您会尽可能地进行非规范化,然后使用唯一键来查找数据。
If you need to pull data from two sources, you would have to join the resulting set together by hand.
如果您需要从两个来源提取数据,则必须手动将结果集连接在一起。
回答by Cruachan
All databases were originally non-relational, it was only with the arrival of DB2 and Oracle in the mid 1980's that they became common. Before that most databases where either flat files or hierarchical.
所有的数据库最初都是非关系型的,直到 1980 年代中期 DB2 和 Oracle 出现后,它们才变得普遍。在此之前,大多数数据库要么是平面文件,要么是分层的。
Flat files are inherently boring, but hierarchical database are much less so, particularly as DB2 was actually implemented on top of an hierarchical implementation (namely VSAM) in the first instance. VSAM is I believe still around on mainframe systems and is of some considerable importance.
平面文件本质上是无聊的,但层次数据库则要少得多,特别是因为 DB2 实际上是在第一个实例的层次实现(即 VSAM)之上实现的。我相信 VSAM 在大型机系统中仍然存在,并且具有相当重要的意义。
DB/1 (so obscure now I can't even find a wikipedia link) was IBM's predecessor prime-time database to DB2 (hence the name). This was hierarchical - basically you had a file which consisted of any number or 'root' records, generally directly accessible by a key. Each root record could then have any number of child records off it, each of which could in turn have it's own children. The net effect is a index file or root records with each root being the top of a potential tree-like structure. Accessing the child records could be tricky - there were limitations of direct access so usually you ended up traversing the tree looking for the record you needed. A 'database' could have any number of these files in it, usually related by keys.
DB/1(现在太模糊了,我什至找不到维基百科链接)是 IBM 的前身 DB2 黄金时段数据库(因此得名)。这是分层的——基本上你有一个由任意数字或“根”记录组成的文件,通常可以通过一个键直接访问。每个根记录然后可以有任意数量的子记录,每个子记录又可以有它自己的子记录。最终效果是索引文件或根记录,每个根都是潜在树状结构的顶部。访问子记录可能很棘手 - 直接访问存在限制,因此通常您最终会遍历树以查找所需的记录。“数据库”中可以包含任意数量的这些文件,通常通过键关联。
This had major disadvantages - not least that actually doing anything demanded a full program written - basically the equivalent of a days work for what we can now do in SQL in a few minutes. However it really did score on execution speed, in those days a mainframe had about the processing power of your iPhone (albeit optimized for data I/O) and poor DB2 queries could kill a multi-million dollar installation dead. This was never an issue with DB/1 and in a world where programmers were less expensive than CPU time it made sense.
这有很大的缺点——尤其是实际上做任何事情都需要编写完整的程序——基本上相当于我们现在可以在几分钟内用 SQL 完成的工作一天。然而,它确实在执行速度上得分,在那些日子里,大型机的处理能力与你的 iPhone 差不多(尽管针对数据 I/O 进行了优化),而糟糕的 DB2 查询可能会导致数百万美元的安装死亡。这对于 DB/1 来说从来都不是问题,而且在程序员比 CPU 时间更便宜的世界里,这是有道理的。
回答by Guido
The App Engine datastore is not a relational database. While the datastore interface has many of the same features of traditional databases, the datastore's unique characteristics imply a different way of designing and managing data to take advantage of the ability to scale automatically.
App Engine 数据存储区不是关系数据库。虽然数据存储接口具有许多与传统数据库相同的功能,但数据存储的独特特征意味着设计和管理数据的不同方式以利用自动扩展的能力。
回答by Lance Roberts
The PI historical database from OSIsoft is non-relational. It's only made to archive timestamped data. It's used a lot by industry, especially as the back-end database for all those 'dashboards'.
OSIsoft 的 PI 历史数据库是非关系型的。它仅用于存档带时间戳的数据。它被行业广泛使用,尤其是作为所有这些“仪表板”的后端数据库。
There's no need to be relational in it, since there are no joins.
没有必要在其中建立关系,因为没有联接。
回答by Jean Barmash
Other two types of databases that haven't come up yet:
其他两种还没上来的数据库:
Content Repositories are databases designed for content (i.e. files, documents, images, etc). They typically have additioan constructs such as a hierarchical way to browse content, search, transformation between different formats, versioning, and many other things. Examples - Alfresco, Documentum, HymanRabbit, Day, OpenText, many other ECM vendors.
Directories, i.e. Active Directory, or LDAP Directories. These are databases designed for low-write / high read scenarios and highly distributed across high geographical distances / high latency connections. While mostly used for authentication / authorization, they don't have to be if your use case matches the requirements.
内容存储库是为内容(即文件、文档、图像等)设计的数据库。它们通常具有附加结构,例如浏览内容、搜索、不同格式之间的转换、版本控制和许多其他内容的分层方式。示例 - Alfresco、Documentum、HymanRabbit、Day、OpenText 和许多其他 ECM 供应商。
目录,即 Active Directory 或 LDAP 目录。这些数据库专为低写入/高读取场景而设计,并且高度分布在远距离/高延迟连接之间。虽然主要用于身份验证/授权,但如果您的用例符合要求,则不必如此。
回答by CurtTampa
Non-Relational databases just do not meet Codd's requirements. Intersystems Caché seams a total re-write/re-design of the old Pick Operating system's database. From the little I've read of Caché it appears to be a nicely done redesign. It permits .net programs to access the database just like it would SQL. Caché's run's the Pick OS programs without requiring any changes. By importing your Pick files into Caché you can still run your old green screen applications with it, but also write new programs using .net so you can migrate to Windows Applications without abandoning the years of data design you've already invested in. Here is some background on the Pick DB model . A Pick database uses totally variable length records, and fields. All table are keyed by a single unique key and are accessible without reading an index. Pick designed the system to use a Hashing algorithm that reads the item from disk on generally on the 1st physical read (assuming system maintenance was performed correctly). Fields in Pick are Non-Typed. All data is stored as string and Casting is up to the programmer. Nulls are stored as a empty string, thus a null does not take up disk space as it does in SQL. There is no need for Foreign Keys. In the ‘Relational world' the DBA has to create and Order Header table, and an Order Line Item table. In the “Pick Model' there is a single table. An example would be, ‘Order Date' is a field that would store a # of days since ‘Dec 13, 1967' (the data Pick OS was turned on for the first time). Pick programmers did not have Y2k problems. A 2nd column would be Customer Number. The big difference is when you get to the Product Number Column, it would be ‘Multi-Valued' (the Codd Non-Conformance). In other words, the database can handle 1-32000 product#s in that column. Other columns like Quantity Ordered would be in a controlling/dependant relationship with the Product Number and would also be multi-valued. When you get to the Quantity Shipped, Pick would go to a third dimension and have Sub-Multi-Valued field. You would have a Shipment Number Column, and it would be Multi-Valued by Line Item and Sub-Multi-Valued containing The Shipment Quantity for that line for that shipment number. There are No Inner Joins needed. All data for that Order is stored in One Table and in a single record. No orphan rows ever! Secondly the data definition is a bit different. Our dictionaries can contain definitions for data that is not in this table or is being manipulated. A couple of examples are, Customer Name. It would be defined as ‘Use the Customer number column and return the Name field from the Customer Table. Another Example is Line Item Extension would be defined as a calculation of Quantity*Price/PricePer. I believe I read somewhere Caché claims to have over 100,000 installations.
非关系型数据库不符合 Codd 的要求。Intersystems Caché 对旧的 Pick 操作系统数据库进行了完全重写/重新设计。从我读过的关于 Caché 的一小部分来看,它似乎是一个很好的重新设计。它允许 .net 程序像访问 SQL 一样访问数据库。Caché 运行的 Pick OS 程序无需任何更改。通过将您的 Pick 文件导入 Caché,您仍然可以使用它运行旧的绿屏应用程序,还可以使用 .net 编写新程序,以便您可以迁移到 Windows 应用程序,而无需放弃您已经投入多年的数据设计。这里是Pick DB 模型的一些背景知识。Pick 数据库使用完全可变长度的记录和字段。所有表都由一个唯一键作为键,无需读取索引即可访问。Pick 将系统设计为使用哈希算法,该算法通常在第一次物理读取时从磁盘读取项目(假设系统维护正确执行)。Pick 中的字段是非类型化的。所有数据都存储为字符串,转换由程序员决定。空值存储为空字符串,因此空值不会像在 SQL 中那样占用磁盘空间。不需要外键。在“关系世界”中,DBA 必须创建订单标题表和订单行项目表。在“选择模型”中有一个表。例如,“订单日期”是一个字段,用于存储自“1967 年 12 月 13 日”以来的天数(数据 Pick OS 首次打开)。Pick 程序员没有 Y2k 问题。第二列是客户编号。最大的区别是当你进入产品编号列时,它将是“多值”(Codd 不符合项)。换句话说,数据库可以处理该列中的 1-32000 个产品编号。其他列(如订购数量)将与产品编号处于控制/依赖关系,并且也将是多值的。当您到达 Quantity Shipped 时,Pick 将转到第三维并具有 Sub-Multi-Valued 字段。您将有一个装运编号列,它将按行项目进行多值计算,并包含该装运编号的该行的装运数量的子多值。不需要内部联接。该订单的所有数据都存储在一张表和一条记录中。没有孤行!其次,数据定义有点不同。我们的字典可以包含不在该表中或正在被操作的数据的定义。几个例子是,顾客姓名。它将被定义为'使用客户编号列并从客户表中返回名称字段。另一个例子是 Line Item Extension 将被定义为 Quantity*Price/PricePer 的计算。我相信我在某个地方读到过 Caché 声称有超过 100,000 次安装。
回答by johnstok
Be aware that the concept of relational databases is highly contentious. Purists such as C. J. Datewould argue that many databases in common use (such as Oracle and SQL Server) do not comply sufficiently with the relational model to be termed 'relational'.
请注意,关系数据库的概念极具争议。CJ Date等纯粹主义者会争辩说,许多常用的数据库(例如 Oracle 和 SQL Server)并没有充分遵守被称为“关系”的关系模型。