[ENG VER] What is NoSQL? This is the Definition of NoSQL along with the Explanations
Assalamu‘alaikum wr. wb.
Hello guys! If you often want to learn about Web/App Development (Web/App Development), you certainly know what is Database. If SQL is more of a Query Language used in Databases, while NoSQL is Data that allows unstructured and semi-structured data to be stored and managed easily. For more, let's discuss in this post.
A. Definition of NoSQL
What is NoSQL? NoSQL is an approach to database management that can accommodate a wide variety of data models, including key-value, document, columnar and graph formats. A NoSQL database generally means that it is non-relational, distributed, flexible and scalable. Additional common NoSQL database features include the lack of a database schema, data clustering, replication support and eventual consistency, as opposed to the typical ACID (Atomicity, Consistency, Isolation and Durability) transaction consistency of relational and SQL databases. Many NoSQL database systems are also open source.
However, the ubiquity and usefulness of SQL caused many NoSQL databases to add support for SQL. Today it is commonly accepted that NoSQL stands for "Not Only SQL." The Example of Big Companies like Facebook/Meta and Google are also using NoSQL in their business. The reason is, NoSQL has the ability to support real-time web applications that are developed.
How can this database management be so useful? This is because it is supported by the choice of various types of databases that can be used as needed.
B. Types of NoSQL Databases
In general, NoSQL databases are divided into 4 (Four) types, namely :
1. Key-value
This type of database stores the database in key/value pairs in the form of a simple hash table. So, it is suitable for use by those of you who want to store a lot of data without using complicated queries when processing it.
In Key-value, each key is unique, while the value can be JSON, BLOB (Binary Large Objects), string, and so on. For example, you can see it below :
2. Column-based
Column-based (also known as wide-column) is a type of NoSQL database that stores data in columnar form. So, column-based is very suitable for SUM, COUNT, AVG, MIN, and the like Query (Similar to Formulas in Excel).
An example of column-based NoSQL you can see below :
The main advantage of column-based NoSQL is the flexibility of the columns. Each column is independent of any other column. So, you are free to change any column without affecting the others.
Some of the popular Column-based Databases are Accumulo, Amazon SimpleDB, HBase, Cassandra, and Hypertable.
3. Document-oriented
This type of database uses data that contains a key and value pair that is stored in a document in JSON or XML format. Value here can be in the form of strings, numbers, booleans, arrays, to objects.
For clarity, here's a comparison of document-oriented NoSQL and relational SQL :
For those of you who are familiar with JSON, you will certainly see the similarity of the structure used by these types of NoSQL. The structure is different from a SQL-style relational table which has rows and columns.
With this approach, you don't need to know the columns beforehand like in SQL. Very flexible, right? Not surprisingly, this type of document-oriented database is mostly used for CMS, blogging platforms, real-time analytics, and e-commerce applications.
Some popular document-oriented databases are Amazon SimpleDB, CouchDB, and MongoDB.
4. Graph-based
Graph-based is a type of NoSQL database that focuses on storing relationships between entities. These entities are stored in the form of nodes, while the relationships between entities are referred to as edges.
Here's an example of a graph-based NoSQL :
Graph-based is very suitable to be used if you want to find interconnected patterns in data. Therefore, this type of database is generally used for social media, fraud detection, and spatial data.
Some popular graph-based databases are Neo4J, JanusGraph, and InfiniteGraph.
So, these all the Difference between Document-based Databases, Graph-based Databases, Key-value Databases, and Wide-column Databases in NoSQL Family :
Image Source : Techtarget.com |
C. Advantages of NoSQL
Here are some of the Advantages of NoSQL compared to Relational Databases :
1. Easier and Cheaper Scalability
NoSQL makes the process of “scale out” easier. This Scalability method allows you to easily add cloud servers and connect them to database clusters.
So, we don't have to buy new hardware that is more sophisticated and more expensive to handle data spikes.
2. Save A Lot Of Data Without Sacrificing Performance
Did you know that NoSQL can store a lot of data at once without sacrificing performance? This is because it is easy to “scale out” at any time according to our previous explanation.
So, when there is a data spike you can freely add servers to accommodate the load evenly. This is one of the reasons many large companies use it.
3. High Flexibility Supporting Multiple Database Types
NoSQL is a very flexible database management. Not only supports four types of databases, NoSQL is also capable of storing unstructured, semi-structured, and structured data.
This means that you are more flexible in managing the database, both according to your needs and according to the data you have.
Say, your data is still variable and growing, so you don't have to go through the hassle of designing a table schema from scratch like SQL.
4. More Developer-Friendly
Managing a database is indeed one of the mandatory skills of a developer. Although the work is not easy, with the help of NoSQL the process can be simpler. And here are some reasons :
- You don't have to write SQL Query which gets more complex as the data increases.
- Data in NoSQL can be in the form of JSON or XML which is certainly more familiar to developers.
- You can display data quickly without having to create a continuous schema.
- There are many NoSQL databases that are open-source and free. So, you can save money if you want to try the match first.
D. Disadvantages of NoSQL
The Disadvantages of using a NoSQL Database include the following :
- Each NoSQL database has its own syntax for querying and managing data. This is in contrast to SQL, which is the lingua franca for relational and SQL database systems.
- Lack of a rigid database schema and constraints removes the data integrity safeguards that are built into relational and SQL database systems.
- A schema with some sort of structure is required in order to use the data. With NoSQL, this must be performed by the application developer instead of the database administrator.
- Because most NoSQL databases use the eventual consistency model, they do not provide the same level of data consistency as SQL databases. At times the data will not be consistent, which means they are not well-suited for transactions that require immediate integrity, such as banking and ATM transactions.
- Because NoSQL databases are newer, there are no comprehensive industry standards as with relational and SQL DBMS offerings.
E. Difference between SQL and NoSQL
At a high level, SQL databases are general purpose, whereas NoSQL databases are engineered for specific use cases. The primary differences between NoSQL and SQL can be summed up in the following 5 (Five) Categories, i.e. API, data model, schema requirement, scalability and data integrity. Each deploys a different approach to these aspects of data storage and retrieval.
The following are the Differences between SQL and NoSQL that you can consider before using them :
Differences | SQL | NoSQL |
Types | RDBMS or Relational Databases | Non-relational database or distributed database |
Functions | To process data in Online Analytical Processing (OLAP) | To process data related to increasingly complex modern applications and websites |
Query Languages | Structured Query Language (SQL) | Does not require a query language that is too complex |
Database Sctructures | Table-shaped | Can be in the form of key-value, column, document, and graph |
Schemas | Need to be determined first | Dynamic schema for unstructured data |
Scalability Type | Vertical scale or scale up by buying new hardware. | Horizontal scale or scale out by adding servers. |
Database Examples | MySQL, PostgreSQL, MS-SQL | Redis, Neo4j, MongoDB |
Although at first glance similar, NoSQL is different from SQL in terms of data management. NoSQL is a non-relational database management that has 4 (Four) Types, namely Key-value, Column-based, Document-oriented and Graph-based.
To read the previous Article on Databases, please see in here. And to see this Article in Indonesian, can be see in here.
For NoSQL Implementation, stay tuned for the next post about MongoDB Tutorial. So, stay tuned!
Thank You šššš :)
Wassalamu‘alaikum wr. wb.