System design: SQL vs NoSQL

1.Data organization
SQL: SQL databases provide a store of related data tables.
NoSQL: NoSQL databases store JSON-like field-value pair documents, similar documents can be stored in a collection, which is analogous to an SQL table,  but the structure of data is not restricted.
SQL tables create a strict data template, so it’s difficult to make mistakes. NoSQL is more flexible and forgiving, but being able to store any data anywhere can lead to consistency issues.
2.Schema
SQL:required, schema can contains information such as primary keys , indexes , relationships, and functionality such as triggers .
NoSQL:No  need to specify a document design or even a collection up-front. 
A NoSQL database may be more suited to projects where the initial data requirements are difficult to ascertain.
3.Normalization
SQL: reduce data redundancy.
NoSQL:fast query but writing  to multiple entry.
4.Ralational
NoSQL has no equivalent of JOIN
5.Data Integrity
data integrity options are not available in NoSQL databases; you can store what you want regardless of any other documents. Ideally, a single document will be the sole source of all information about an item.
6. Transaction
In SQL databases, two or more updates can be executed in a transaction.
In a NoSQL database, modification of a single document is atomic. In other words, if you’re updating three values within a document, either all three are updated successfully or it remains unchanged. However, there’s no transaction equivalent for updates to multiple documents. 
7.Scaling
NoSQL’s simpler data models can make the process easier, and many have been built with scaling functionality from the start

Summary

Projects where SQL is ideal:

  • logical related discrete data requirements which can be identified up-front
  • data integrity is essential
  • standards-based proven technology with good developer experience and support.

Projects where NoSQL is ideal:

  • unrelated, indeterminate or evolving data requirements
  • simpler or looser project objectives, able to start coding immediately
  • speed and scalability is imperative.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值