Hello DEV! It's been some time but here I am with an article that took a lot of research, as I felt that the answers here were not enough for me. I suggest you first check this article I made about Relational Databases to be able to understand this article more easily.
Relational Databases were created some time ago when Waterfall model was very popular, but they were not designed to cope with the scale and agility of modern applications, neither to take advantage of the commodity storage and processing power available today.
NoSQL are type of databases created in the late 90s to solve these problems, called like that because they didn’t use SQL (but today they are called “Not Only SQL” due to some Management Systems which implement Query Languages). NoSQL databases mostly address some of the points: being non-relational, distributed, open-source and horizontally scalable.
It is important to mention that nowadays Relational Databases have improved dramatically, having resolved most of the problems they had when dealing with today's technology. NoSQL Databases are another way of storing data, not necessarily better than Relational Databases. Both are designed to resolve different kinds of needs.
Note: Some rules will depend on the Management System you choose.
Key-value Stores are the simplest NoSQL databases. Every single item in the database is stored as an attribute name (or 'key'), together with its value, similar to a dictionary.
Features
Operations
Limitations
Real life examples
Key-Value would be best-fit to store user profile:
Key-value databases
Document Stores pair each key with a complex data structure known as a document that can contain many different key-value pairs, or key-array pairs, or even nested documents. Documents are treated as wholesome and splitting a document into its constituent name/value pairs are avoided.
Features
Operations
Types
XML Databases:
JSON Databases:
Data modelling
Limitations
Real life examples
Here is a list of real life cases.
Document databases
Graph Stores are an expressive structure with the collection of Nodes and relationships interlinking them, used to store information about networks of data, such as social connections. Based on the mathematical theory of graphs.
Parts of a graph
Understanding Graph theory
According to Graph theory, the major constituents of a graph include:
Graph theory assigns mathematical notation for
Core Rule - 'No broken links': A relationship should always have a start and end node. Deletion of a node is not possible without deleting its associated relationships.
Types
At a very high level, Graph store can be categorized into two kinds:
1) Graph Database - (Real-time)
2) Graph Compute Engine - (Batch Mode)
Features
Operations
Will depend on it’s query language. For example, Neoj4 uses Cypher Query Language.
Limitations
Real life examples
Graph Store is used to model all kind of different scenarios such as:
Graph databases
Wide-column/Columnar/Column Stores are optimized for queries over large datasets, which are stored on a column-family basis. Column stores databases use a concept called a keyspace. A keyspace is kind of like a schema in the relational model. The keyspace contains all the column families, which contain rows, which contain columns.
Columnar databases are pretty different from relational databases under the hood: instead of tables comprising a set of rows or tuples which have a value for each column, tables are a set of columns, each of which may or may not contain a value for a particular row key.
Features
These are just some of the benefits that make columnar databases a popular choice for organizations dealing with big data.
Operations
Operations and some features vary wildly depending on the Management System you use.
Limitations
Real life examples
It is very important to understand the limitations of NoSQL database. NoSQL can not provide consistency and high availability together. This was first expressed by Eric Brewer in CAP Theorem.
CAP theorem or Eric Brewers theorem states that we can only achieve at most two out of three guarantees for a database: Consistency, Availability and Partition Tolerance.
No system can provide more than 2 guarantees. In the case of a distributed systems, the partitioning of the network is a must, so the trade-off is always between consistency and availability.
If you want to know more about CAP, check this link and this one.
Take into consideration that this comparison is at database level, it doesn’t include any management system that implements both of them. Database Management Systems include their own techniques to sort this problems and also improve performance and reliability.
Scaling
Maintenance
Data Model
Note: It's worth to mention that relational databases have been getting better at working with un-structured or semi-structured data, with PostgreSQL's indexable binary JSONB datatype leading the pack. If you have a mix, fitting your unstructured data into a relational context is a lot easier and safer than trying to adapt your relational data into a NoSQL context.
Caching
Now that we have gone through the different kinds of NoSQL, you should know by now that NoSQL databases are not similar and are not made to solve the same problems.
It is important to understand which database is appropriate depending of the scenario. The parameters to be taken into consideration when choosing a NoSQL database are:
The best way to group them is comparing their features to choosing the correct one for the problem we are facing.
Scalability
Transactional integrity and consistency
Data modeling
Relational Database Management Systems (RBDMS) offers a consistent and organized way of modeling data with standardized implementation. The NoSQL world does not offer any room for the standardized and well-defined data model as they are not bound to solve the same problem or have the same architecture.
MongoDB has gradually adopted few RDBMS concepts, like:
Query support
Querying data from any database with ease and effectively is considered to be an interesting puzzle to be solved. With standardized syntax and semantics, RDBMS thrives on SQL support for easy access to data.
Access and interface availability
You should choose a NoSQL database over a Relational database if:
Polyglot: Knowing or using several languages.
Polyglot programming allow us to choose the appropriate language for the appropriate task. One database does not fit all sizes and knowledge and adoption of more than one database is a wise strategy. The knowledge and use of multiple database products and methodologies are popularly now being called polyglot persistence.
Benchmarking allow us to get an insight on how the different NoSQL products stack up.
The design of NoSQL databases depends on the type of database.
I hope you find this article useful and if you see some error and want me to correct it don't hesitate to tell me in the comments!
Thanks to Dian Fay and Slavius for corrections made in the comments!
Thank you for reading. Don't forget to follow me on dev.to and Twitter!
Currently developing futuristic smart-device, IoT connected, highway construction site safety system in EU. Used to work on infrastructure, application architecture and cloud engineering.
Slovakia, Europe Bachelor degree of CS Aug 9, 2018 Dropdown menuTalking about advantages and disadvantages is biased.
For me, my projects and products I work on the list of your advantages are actually mostly disadvantages and vice versa.
Generally your presentation of NoSQL is suggesting it is a modern replacement for SQL, which it is not. Please update your introduction with a proper description why NoSQL has emerged and where it fits. Then the advantages and disadvantages would apply fully in that area.
Like comment:3 likes Like Comment button
Lucas OliveraI work as a Salesforce Developer. I have been programming since I was 9, I like Javascript, Python and Game Development. I write articles in dev.to too!