SQL vs noSQL Database: Which is BETTER?
Historically, a relational database has focused on the reliability of transactions under the well-known ACID principle, an acronym for Atomicity, Consistency, Isolation and Durability (Atomicity, Consistency, Isolation and Durability in Spanish). Under these properties it is intended that a transaction on a database is always completed or not (atomicity), that the data is kept in a valid state at all times (consistency), that it is independent (isolation) and that it is permanent against failures. of the system (durability).
The ACID principle brings robustness that collides with performance and operability as data volumes grow.
ACID principle, typical of relational databases:
When the magnitude and dynamism of the data become important, the ACID principle of relational models takes a back seat to performance, availability and scalability, the characteristics most typical of NoSQL databases. Today, modern data systems on the Internet are more in line with the also known BASE principle, acronym for Basic Availability (availability as priority) Soft state (data consistency is delegated to management external to the database engine) Eventually consistency (trying to achieve convergence towards a consistent state)
The basic principle, common in NoSQL DB:
The main difference between a relational database (RDBMS) and a NoSQL lies in the concept of the structure of the data. With a NoSQL model, information is stored in more flexible ways that do not have the restriction of adopting a predefined format, as occurs in relational databases (tables whose structure follows a schema). Thanks to this, it is much easier to distribute data between systems without having to maintain a complex migration mechanism. Furthermore, this design benefits horizontal scalability by simply adding nodes to distribute the load, which takes advantage of the vertical scalability (increased processing power and memory) needed in relational databases. These reasons mainly, make NoSQL databases the candidates to adopt when it comes to handling large volumes of data of a very varied nature.
NoSQL database types and classification:
There are about 150 types of NoSQL databases with different data architecture (document-based, key / value-based, object-based, graph-based, column-based, etc.). Among the best known are Cassandra, Hadoop, MongoDB, CouchDB or Redis. Giants like Oracle also have a NoSQL implementation.
According to the type or model chosen to store the data, NoSQL databases are grouped into four main categories:
- Key / Value: Data is stored and is located and identified using a unique key and value (a data or pointer to the data). Examples: DynamoDB, Riak, Redis. Amazon and Best Buy among others use this implementation
- Columns: Similar to the key / value model, but the key is based on a combination of column, row, and timestamp that is used to reference sets of columns (families). It is the most similar implementation to relational databases. Examples: Cassandra, BigTable, Hadoop / HBase. Companies like Twitter or Adobe make use of this model.
- Documents: The data is stored in documents that encapsulate the information in XML, YAML, or JSON format. Documents have self-contained field names in the document itself. The information is indexed using those field names. Examples: MongoDB, CouchDB. We have a case of use of this technology with Netflix, a company that provides audiovisual content online.
- Graphs: A graph model is followed that is spread across multiple machines. It is an appropriate model for data whose relationships conform to this model, such as transport networks, maps, etc. Examples: Neo4J, GraphBase.
It means when we are requiring very large database then it is better idea to use nosql instead of sql.Your data needs scale up, out, and down. As discussed above, NoSQL provides much greater flexibility along with the power to control costs as the data needs change.You have a lots of data, a variety of data types, and your data needs is only going to grow as time passes. NoSQL allows you to keep various different forms of data together and without needing to invest time into defining which kind of data you’re storing ahead of time.
Consider Reading to these articles: