开发者

SQL vs noSQL build examples

开发者 https://www.devze.com 2023-01-13 22:42 出处:网络
Could I have a list of type of applications I should build on a sql 开发者_开发知识库database and a list of applications i should build on a nosql database?There is no list and the real answer IMHO is

Could I have a list of type of applications I should build on a sql 开发者_开发知识库database and a list of applications i should build on a nosql database?


There is no list and the real answer IMHO is the classic "It Depends".

In very loose terms, financial applications where consistency is critical would be an example of something not suitable for NoSQL - in that case, ACID is crucial.....BASE would not be suitable (Basically Available Soft state Eventually consistent).

You really need to understand what NoSQL has to offer vs RDBMS, and the tradeoffs in order to know whether it is suitable for a given scenario.


When chosing there is no one-stop fit all solutions

USE SQL When:

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.

USE Nosql When

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.

More about Non-Relational databases :

  1. Key-Value Stores :- stores data in key value pairs, Eg. Redis, Voldemort etc
  2. Document Databases:- Data store based on a documentid. Eg. CouchDB, MongoDB etc
  3. Wide-Column Databases :- Stores data in terms of columnar rather than rows Eg: Cassandra, HBase etc
  4. Graph Databases:- Data represented in terms of links and nodes. Eg. Neo4J, InfiniteGraph

Example: Key Value based data Eg: Cassandra, Mongodb "Eg: For Id=123 Value = { ""name"":""Lalith Swarna"", ""address"":{ ""street"":""Gachibowli Road"", ""city"":""Hyderabad"" }, ""company"":""ais"", ""role"":""Specialist"" }"

Advantages:

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

Disadvantages:

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.
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号