When to choose NoSQL over SQL?
The agenda of this blog is simple. Well discuss various parameters that we keep in mind while deciding a perfect database for our Application Service.
In terms of data engineering, data pressure is the ability of the system to process the amount of data at a reasonable cost or a reasonable time. When one of those dimensions is broken, thats a technology trigger and new inventions happen that result in new data technologies. In simple terms
SQL is not obsolete, its just that now we have a different choice.
Before we jump up to comparing SQL and NoSQL databases, lets take some time to appreciate the fact that SQL has been long into the industry (over 30+ years) and still has a good place in the modern application development environment.
Comparison Time
SQL: Optimized for Storage
NoSQL: Optimized for Compute/QueryingSQL: Normalized/relational
NoSQL: Denormalised(Unnormalized)/HierarchicalSQL: Table based data structure
NoSQL: Depending on DBs, the data structures are
Key-Values(DynamoDB, Redis, Voldemort)
Wide-column i.e. containers for rows(Cassandra, HBase)
Collection of Documents(MongoDB, CouchDB, DynamoDB)
Graph Structures(Neo4J, InfiniteGraph)SQL: Ad hoc queries
NoSQL: Instantiated viewsSQL: Scale Vertically & Expensive. Can Scale Horizontally but challenging & time-consuming
NoSQL: Scale Horizontally & CheapSQL: Fixed schema, altering requires modifying the whole database
NoSQL: Schemas are dynamicSQL: Good for OLAP
NoSQL: Good for OLTP at scaleSQL: ACID(Atomicity, Consistency, Isolation, Durability) properties
NoSQL: BASE(Basically Available, Soft state, Eventual consistency) properties
When to choose NoSQL?
For our application service, when it comes down to ...
Well-known and well-understood types of access patterns
Want simple queries
Not much data calculation involved
Have a common business process
OLTP apps
If this is true, then NoSQL is a perfect Database and would be most efficient. We have to structure the data model specifically to support the given access pattern.
When NOT to choose NoSQL?
If our application service has the requirements to support ...
Ad-hoc queries. e.g. bi analytics use case or OLAP application
May require reshaping the data
Complex queries, inner joins, outer joins, etc.
Complex value calculations
So in brief, for our application service, if we understand the access patterns very well, theyre repeatable, theyre consistent, and scalability is a big factor, then NoSQL is a perfect choice.
PS: Mature developers dont use the word flexible for NoSQL databases. There is a difference in being dynamic and flexible. Data model design is an intelligent engineering exercise in NoSQL databases.
What your opinion over my discussion up here? Why do you choose NoSQL over SQL?
...
Thanks for reading this blog!
Add a if you liked the comparison. Leave a comment below if you have any questions/feedback. I'm gonna write a Series on DynamoDB here, follow me for updates.
More About Author: Om Bharatiya
Happy Coding <3
Original Link: https://dev.to/ombharatiya/when-to-choose-nosql-over-sql-536p
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To