Skip to main content

Why NoSQL is better than SQL



Handling terabytes worth of data generated every hour is a difficult task for any company but today’s database technologies handle all of this data very easily. In this article we are going to check out by comparing what No SQL is and how it stands against the technology called as SQL.

So first of all “What is data?”, data can be considered as any facts which are basically related to objects. Examples of the data can be images, videos, numerical, texts, music, etc. Next is “What is Database?”, Database is a systematic collection of data which support storage and manipulation of data in an easy way. For example, old school Telephone Directory, Power generation companies, Social media, etc. Some reasons of why do we require a database are Managing large amount of Data accuracy, Ease of Data Upload and Data Security.

SQL – Structured Query Language



Now, let’s come to the main point. “What is SQL?” SQL is the standard language for dealing with relational databases which can be used to create, read, update, and delete database records. Where Relational Database is a type of database that stores and provides access to data points that are related to one another. Relational Databases are based on the relational model, an intuitive, straightforward way of representing data in tables. In a relational database, each row in the table is a record with a unique id called the key. The columns of the table hold attributes of the data, and each record usually has a value for each attribute, making it easy to establish the          relationships among data points. Some Flavours of SQL that are available are MySQL,ORACLE,        MS-SQL Server, etc.

NoSQL - Not SQL

            Now, let’s see “What is NoSQL?”, NoSQL is a non-relational DBMS that does not require a fixed schema, avoids joins and is easy to scale. NoSQL database is used for distributed data stores with HUGE data storage requirements. NoSQL database stands for “ Not Only SQL or Not SQL”. Carl Strozz introduced the NoSQL concept in 1998. NoSQL database system consists of a wide range of database technologies that can store any type of data. Wide variety of data such as structured, semi-structured, and polymorphic data is supported by NoSQL technology. Twitter, Facebook, Google and many other  IT companies use NoSQL technologies on a day to day basis. Some flavours of NoSQL are Amazon DynamoDB, mongo DB, Apache Hbase, Cassandra.  

                      

Limitations of SQL

 

·        Relational Database Management Systems that use SQL are Schema –Oriented i.e. the structure of the data should be known in advance ensuring that the data adheres to the schema.
·        Examples of such predefined schema based applications that use SQL include Payroll Management System, Order Processing, and Flight Reservations.
·        It is not possible for SQL to process unpredictable and unstructured information. However, Big Data applications, demand for an occurrence-oriented database which is highly flexible and operates on a schema less data model.
·        SQL Databases are vertically scalable – this means that they can only be scaled by enhancing the horse power of the implementation hardware, thereby making it a costly deal for processing large batches of data.
·        IT enterprises need to increase the RAM, SSD, CPU, etc., on a single server in order to manage the increasing load on the RDBMS.
·        With increasing size of the database or increasing number of users, Relational Database Management Systems using SQL suffer from serious performance bottlenecks -making real time unstructured data processing a hard row to hoe.
·        With Relational Database Management Systems, built-in clustering is difficult due to the ACID properties of transactions.

                                        

NoSQL vs SQL

1. Nature of Data and Its Storage- Tables vs. Collections

The foremost criterion for choosing a database is the nature of data that your enterprise is planning to control and leverage. If the enterprise plans to pull data similar to an accounting excel spreadsheet, i.e. the basic tabular structured data, then the relational model of the database would suffice to fulfil your business requirements but the current trends demand for storing and processing unstructured and unpredictable information.
To the contrary, molecular modelling, geo-spatial or engineering parts data is so complex to be dealt with – that the Data Model created for this kind of data is highly complicated due to several levels of nesting. Though several attempts were made to model this kind of data with the ‘2D (Row-Column) Database’ - it did not fit. To overcome this drawback, NoSQL database was considered as an alternate option. NoSQL Databases ease the representation of multi-level hierarchies and nesting using the JSON i.e. JavaScript Object Notation format.
In this world of dynamic schema where changes pour in every hour it is not possible to adhere to the “Get it Right First” Strategy - which was a success with the outmoded static schema. Web-centric businesses like Amazon, eBay, etc., were in need of a database like NoSQL vs SQL that can best match up with the changing data model rendering them greater levels of flexibility in operations.

2. Speed – Normalization vs. Storage Cost

RDBMS requires a higher degree of Normalization i.e. data needs to be broken down into several small logical tables to avoid data redundancy and duplication. Normalization helps manage data in an efficient way, but the complexity of spanning several related tables involved with normalization hampers the performance of data processing in relational databases using SQL.
           On the other hand, in NoSQL Databases such as Couchbase, Cassandra, and  MongoDB, data is stored in the form of flat collections where this data is duplicated repeatedly and a single piece of data is hardly ever partitioned off but rather it is stored in the form of an entity. Hence, reading or writing operations to a single entity have become easier and faster.
         NoSQL databases can also store and process data in real time - something that SQL is not capable of doing it.

3. Horizontal Scalability vs. Vertical Scalability

The most beneficial aspect of NoSQL databases like HBase for Hadoop, MongoDB, Couchbase and 10Gen’s is - the ease of scalability to handle huge volumes of data. For instance, if you operate an e-commerce website similar to Amazon and you happen to be an overnight success - you will have tons of customers visiting your website. Under such circumstances, if you are using a relational database, i.e., SQL, you will have to meticulously replicate and repartition the database so as to fulfil the increasing demand of the customers.

The manner in which NoSQL vs SQL databases scale up to meet the business requirements affects the performance bottleneck of the application. Generally, with increase in demand, relational databases tend to scale up vertically which means that they add extra horsepower to the system - to enable faster operations on the same dataset. On the contrary, NoSQL Databases like the HBase, Couchbase and MongoDB, scale horizontally with the addition of extra nodes (commodity database servers) to the resource pool, so that the load can be distributed easily.
4. NoSQL vs SQL / CAP vs ACID                                                                                                                                       Relational databases using SQL have been legends in the database landscape for maintaining integrity through the ACID properties (Atomicity, Consistency, Isolated, and Durable) of transactions and most of the storage vendors rely on properties. However, the main motive is to shore up isolated non-dividable transactions - where changes are permanent, leaving the data in a consistent state. NoSQL Databases work on the concept of the CAP priorities and at a time you can decide to choose any of the 2 priorities out of the CAP Theorem (Consistency-Availability-Partition Tolerance) as it is highly difficult to attain all the three in a changing distributed node system. One can term NoSQL Databases as BASE , the opposite of ACID - meaning:
BA= Basically Available –In the bag Availability
S= Soft State – The state of the system can change anytime devoid of executing any query because node updates take place every now and then to fulfil the ever changing requirements.
E=Eventually Consistent- NoSQL Database systems will become consistent in the long run.


Conclusion
     So why should we choose NoSQL database:
1) Applications and databases need to work with Big Data
2) Big Data needs a flexible data model with a better database architecture
3) To process  Big Data, these databases need continuous application availability with modern transaction support.

References



Comments

  1. Nice explanation

    ReplyDelete
  2. Very nicely explained!!good work!!

    ReplyDelete
  3. Great blog. Very informative!!

    ReplyDelete
  4. Amazing content , very helpful.

    ReplyDelete
  5. Great explanation!!!!

    ReplyDelete
  6. I had an amazing read. The blogs was perfectly detailed and to the point. Definetly beneficial. Kudos to the authors.

    ReplyDelete
  7. Very informative, useful and detailed content explanation!!
    Nice blog and great efforts!!

    ReplyDelete
  8. Great blog, Impressive ๐Ÿ‘๐Ÿ‘

    ReplyDelete
  9. Very good blog...quite Useful and contents are well written. ��

    ReplyDelete
  10. Very helpful information,my lot of doubts r cleared๐Ÿ‘

    ReplyDelete
  11. Basic details are explained very well

    ReplyDelete
  12. Very helpful information๐Ÿ‘Œ๐Ÿ‘Œ

    ReplyDelete
  13. Very informative

    ReplyDelete
  14. It's nice work. Very informative blog. Awesome work. ๐Ÿ‘Š๐Ÿ˜Š

    ReplyDelete
  15. Nice blog. I was looking for it since long time. Thank you for this informative blog.

    ReplyDelete
  16. Very nicely written guys .The differences between noSQL and SQL and why should we prefer NoSQL is described very nicely.And not only it is informative it aslo properly presented. I go through many tech blogs and I must appreciate your work for this excellent job.great job guys !!keep it up !!

    ReplyDelete
  17. Great job guys Keep it up !
    CAP theorem is very informative

    ReplyDelete

Post a Comment