Databases are a fundamental part of our information society today. They organize electronic data and regulate access to it. Databases have a wide range of applications, both commercial and private. Each database system has a database management system based on a specific database model. While the history of the database began with the hierarchical model, today the relational database model is the...Databases – why do you need them and what kinds are there?
The requirements of modern application development have changed fundamentally over the past 15 years. Ever-increasing volumes of data need to be stored, processed and updated more and more quickly. When it comes to managing large amounts of data, non-relational or NoSQL databases have been a popular choice for some time. But what is NoSQL exactly? And what are the advantages of this modern approach to data storage?
What is NoSQL?
NoSQL stands for not only SQL, a name that sums up the database model in a nutshell. Rather than being a separate alternative, it’s an enhancement and useful addition to traditional relational SQL databases. NoSQL databases overcome the limits of relational systems by using alternative database models. But this doesn’t necessarily mean that NoSQL databases don't use any SQL systems. There are also many hybrid variants that use both solutions and still fall under the umbrella of NoSQL.
Until the late 2000s, SQL databases were the ultimate in application development. Other approaches, such as object-oriented databases, never reached this level of popularity due to their complex handling and implementation. NoSQL databases were developed as a viable alternative to SQL in response to the limitations and problems of relational databases, which often cannot meet the requirements of modern application development. NoSQL systems use innovations like cloud servers to offer an alternative data model in which many different types of data can be stored and processed. The resulting data structures are powerful and flexible and can react quickly to changing requirements.
NoSQL systems are often called structured data stores to emphasize the key difference between NoSQL and relational SQL databases: NoSQL databases don’t use rigid tabular schemas in which data must be defined before storage. They use more flexible methods that make it easy to add new data sets, which are continuously updated in the application. NoSQL solutions are also useful for processing unstructured or unknown data, which is not possible with a relational database.
How do NoSQL databases work?
Unlike relational SQL-based databases, NoSQL databases don’t use conventional tables with rows and columns to store data. Instead, they organize large amounts of data using flexible techniques such as documents, graphs, pairs of values, and columns. This makes NoSQL systems ideal for applications that must process a high volume of data and therefore require flexible structures. NoSQL systems use hardware clusters and cloud servers, so capacity is evenly distributed, and the database runs smoothly even when data volumes are high. In contrast to relational databases, which rapidly lose performance as the amount of data increases, NoSQL databases are a powerful, flexible, and scalable solution even with large volumes of data.
Horizontal scaling is another special feature of NoSQL systems. Relational SQL databases are scaled vertically and run on a single server. To increase their capacity, you would have to invest in a more powerful server. This is expensive in the long term and limits the possibilities of application development. NoSQL solutions usually distribute data across multiple servers. If the amount of data increases, new servers are simply added. This allows NoSQL databases to easily store and process large amounts of data, making them ideal for big data applications.
The four most important types of NoSQL databases
Unlike relational databases, structured data stores do not use fixed schemas and are therefore perfect for big data applications. Many different NoSQL systems are already in use around the world, most of which are open source and structured differently depending on the provider and requirements. Although systems vary widely, the different approaches to NoSQL fall into four main categories.
A graph database employs nodes and edges to represent relationships between data. The network of relationships between the data is organized using nodes and their connections to each other. For data sets with highly interconnected information, NoSQL graph databases offer much better performance than relational SQL databases. They are mainly used in social media applications, for example to represent the relationships between followers on Twitter or Instagram.
Whereas SQL databases use rigid schemas and tables, key-value databases store data in the form of key value pairs. The individual values are associated with specific keys, with the data set itself acting as a key and representing a value. The key also forms an index that can be used to search the database. The keys of NoSQL key-value databases are always unique and are similar to the primary keys of relational databases.
Unlike relational database models, column-oriented database systems store data in columns instead of rows. This results in faster data reading processes and higher performance. This NoSQL model is primarily used for data mining and analytics applications.
Advantages of NoSQL over SQL
Depending on the application, NoSQL may offer certain advantages over traditional relational databases: Whereas SQL systems are quickly stretched to capacity, for example when handling big data, NoSQL databases feature high-performance, scalable models that can read and process large amounts of data at top speed.
NoSQL databases avoid the rigid schemas of SQL systems and use more flexible models that are ideal for processing high volumes of data. Since NoSQL databases store data on distributed hardware clusters, they’re less prone to disruptions and significantly cheaper than installing a single, high-performance server whose resources are regularly exhausted and will then have to be replaced.
|SQL database||NoSQL database|
|Type||One database for everything||Various database models, such as document-oriented, graph, key-value, and column-oriented database|
|Data storage||Individual data (for example, “Book title”) is stored in rows in a table and assigned to specific attributes (for example, “Author,” “Year of publication,” and so on). The data sets are stored in separate tables and merged by the system during complex searches.||Instead of tables, NoSQL databases use either documents, key values, graphs or columns.|
|Schemas||Data type and structure are defined in advance. To store new information, the entire database must be customized (and taken offline).||Flexible. New data sets can be immediately added. Structured, semi-structured, and unstructured data can be stored together; no prior conversion is necessary.|
|Scaling||Vertical scaling. A single server must support the entire database system, causing a drop in performance when data volumes are high.||Horizontal scaling. Each administrator can add new commodity and cloud servers, and the NoSQL database automatically sends the data to all servers.|
|Development model||Open source (such as MySQL) or paid software (Oracle database)||Open source or paid software|
|ACID properties: Atomicity, Consistency, Isolation, Durability||SQL databases have all ACID properties.||ACID transactions are usually not supported in order to keep NoSQL databases flexible and horizontally scalable. Instead, the BASE model is used (Basically Available, Soft State, Eventually Consistent). This model prioritizes availability over consistency.|
|Performance||Uses indexes for large amounts of data. Queries, indexes, and structure must be optimized to improve the performance of SQL systems.||NoSQL databases are much more powerful because they use cloud servers and hardware clusters.|
|APIs||Queries for storing and retrieving data are submitted using Structured Query Language (SQL).||Data is stored and queried via object-based APIs.|
Four popular NoSQL solutions at a glance
Most NoSQL databases use open-source software that any Internet user can download. This makes it much easier to get started with them. You can download a range of free NoSQL applications, learn how they work, and initially use them simply to augment your existing SQL database. The following NoSQL databases are well established:
Cassandra is a column-oriented NoSQL database optimized for storing and processing large data sets.
The document-oriented database CouchDB uses an intuitive HTTP/JSON API and can be implemented for any area of application, from big data to mobile and web.
Neo4j allows you to integrate data into a cloud-based NoSQL graph database. Most importantly, it can graphically represent relationships between individual data sets and recognize patterns.
The key-value database Redis is an in-memory database. It stores data directly in the cache to boost performance.