Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
July 5, 2020 05:11 pm GMT

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

  1. SQL: Optimized for Storage
    NoSQL: Optimized for Compute/Querying

  2. SQL: Normalized/relational
    NoSQL: Denormalised(Unnormalized)/Hierarchical

  3. SQL: 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)

  4. SQL: Ad hoc queries
    NoSQL: Instantiated views

  5. SQL: Scale Vertically & Expensive. Can Scale Horizontally but challenging & time-consuming
    NoSQL: Scale Horizontally & Cheap

  6. SQL: Fixed schema, altering requires modifying the whole database
    NoSQL: Schemas are dynamic

  7. SQL: Good for OLAP
    NoSQL: Good for OLTP at scale

  8. SQL: 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

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To