System design: SQL vs NoSQL

xiaoxiao2021-02-28  36

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-frontdata integrity is essentialstandards-based proven technology with good developer experience and support.

Projects where NoSQL is ideal:

unrelated, indeterminate or evolving data requirementssimpler or looser project objectives, able to start coding immediatelyspeed and scalability is imperative.
转载请注明原文地址: https://www.6miu.com/read-2632373.html

最新回复(0)