SQL vs noSQL构建示例

时间:2010-09-02 07:51:25

标签: sql nosql

我是否可以在sql数据库上构建应用程序类型列表,以及应该在nosql数据库上构建的应用程序列表?

2 个答案:

答案 0 :(得分:1)

没有列表和真正的答案恕我直言是经典的“它取决于”。

在非常宽松的术语中,一致性至关重要的财务应用程序将是不适合NoSQL的示例 - 在这种情况下,ACID是至关重要的...... BASE不适合(基本可用的软状态最终一致)

你真的需要了解NoSQL与RDBMS提供的内容,以及权衡以了解它是否适​​合特定场景。

答案 1 :(得分:0)

选择时没有一站式的解决方案

在以下情况下使用SQL:

1. We need to ensure ACID compliance. For Huge enterprise applications like eCommerce or Banking applications it is a preferred option.
2. When Data is consistent.

何时使用Nosql

1. Want to store large volumes of data that has very little structure or no structure.
2. Rapid development
3. Horizontal scaling possible ie. your database can split across multiple servers.

有关非关系数据库的更多信息:

  1. 键值存储:-将数据存储在键值对中,例如。 Redis,Voldemort等
  2. 文档数据库:-基于文档ID的数据存储。例如。 CouchDB,MongoDB等
  3. 宽列数据库:-以列而不是行的形式存储数据,例如:Cassandra,HBase等
  4. 图形数据库:-用链接和节点表示的数据。例如。 Neo4J,InfiniteGraph

示例:基于键值的数据,例如:Cassandra,Mongodb “例如:对于Id = 123,值= { ""name"":""Lalith Swarna"", ""address"":{ ""street"":""Gachibowli Road"", ""city"":""Hyderabad"" }, ""company"":""ais"", ""role"":""Specialist"" }"

优势:

1. Insert/Retrieval : simple key based w/o any joins Schema is easily
changeable 
2. Built for scaling: data is partitioned internally Built for metrics/analytics/aggregation : Eg Average age, total sal etc

缺点:

1. NOT built for updates(ACID-AtomicityConsistency)  is not followed to update it does Delete and update.
2. Read times are lower than Sql eg: retrieve Age 30  takes all the json and filters the age. 
3. Foreign key constraint not straighforward. 
4. Joins are hard, have to run through everyblock of data find the relevant dataid then join with other table.