Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
October 15, 2021 10:25 pm GMT

SQL vs NoSQL

If you are a beginner wondering what are use cases for SQL or an experienced developer trying to make a choice between SQL or NoSQL for your next project, this article might help you steer your decision the right way.

Pros vs cons

Everything comes at a cost.

While SQL is ACID ( Atomicity, Consistency, Isolation, Durability) compliant which ensures that performed transactions are always consistent, it might be an overkill for your use case.

  • Atomicity - ensures that each database transaction is a single unit that adopts an "all or nothing" approach to execution. If any statement in the transaction fails, the entire transaction is rolled back
  • Consistency A processed transaction will never endanger the structural integrity of the database.
  • Isolation - Transactions cannot compromise the integrity of other transactions by interacting with them while they are still in progress
  • Durability - The data related to the completed transaction will persist even in the cases of network or power outages.

Instead you might find BASE ( Basically available, Soft state, Eventual Consistency ) NoSQL databases to be more of a fit.

  • Basically available - The NoSQL database approach focuses on the availability of data even in the presence of multiple failures. It achieves this by using a highly distributed approach to database management. Instead of maintaining a single large data store and focusing on the fault tolerance of that store, NoSQL databases spread data across many storage systems with a high degree of replication. In the unlikely event that a failure disrupts access to a segment of data, this does not necessarily result in a complete database outage.
  • Soft state - Due to the lack of immediate consistency, data values may change over time. The BASE model breaks off with the concept of a database which enforces its own consistency, delegating that responsibility to developers.
  • Eventual Consistency - The only requirement that NoSQL databases have regarding consistency is to require that at some point in the future, data will converge to a consistent state. No guarantees are made, however, about when this will occur.

For example, if you're dealing with transaction processing where consistency and durability are must-have features then you'll be better off with an ACID compliant DB.
On the other hand, social network feeds do not require such strict compliance so it's acceptable to trade-off ACID in favour of more flexible, easier to scale, approach.

This article does not contain the answer which is better, SQL or NoSQL because as always, it depends on your use case.

Having said that, I highly advise against following the latest trends blindly and flavour of the month technologies. Instead try to define your use case and make a decision based on your needs.


Original Link: https://dev.to/vosse/sql-vs-nosql-534p

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