Find out all you need to know about NoSQL databases
Agile development methodologies and web 2.0 applications have accelerated the use of NoSQL databases that are better suited to their volume, variety and speed requirements.
Introduction
The way web applications handle data has changed significantly over the last decade. More and more data need to be saved, in constant evolution and accessed by more users simultaneously. Scalability and performance have become a challenge for database systems.
Development methodologies have also changed. The old waterfall development cycles that lasted 12 or 18 months are no longer used. Now, small teams work with agile methodologies, performing sprints with rapid iterations to generate functionality every one or two weeks. This leads to constant code evolution and permanent extension or redefinition of data schemas.
Traditional relational storage systems require defining their schema before adding data. Any development of a new feature in an application that uses them often involves a change in this schema, a service interruption, and migration of existing data to the new schema.
NoSQL databases
The use of NoSQL database systems accelerated with the appearance of the new generation of websites where people collaborate and share information online. At that time, the first problems arose to manage the information stored in relational databases.
NoSQL databases are information storage systems that do not comply with the entity-relationship schema. They do not use tables, records, or fields to store data but other formats such as key-value, column mapping, documents, or graphs.
NoSQL databases are information storage systems that do not comply with the entity-relationship schema
Types of NoSQL databases
Depending on how information is stored, we can find different types of NoSQL databases. These are the most used:
- Key-value stores. It is the simplest case of NoSQL databases; each element is stored as an attribute name or key and its value.
- Document databases. Information is stored as a document, generally in JSON or XML format, and a unique key is used for each record. Documents can contain many different key-value pairs, key-array pairs, or even nested documents.
- Graph stores. The information is represented as nodes of a graph, and their relationships are the edges of it. They are used to store network data information, such as social connections.
- Column-oriented databases. In this type of warehouse, each entry is a column, so the data in each entry is arranged one below the other. They are mainly used when large amounts of data have to be analysed.
Advantages and disadvantages of NoSQL
The main advantages of non-relational databases are as follows:
- They are more flexible databases that allow adding information or making changes to the system without the need to add extra configurations, making them better adapted to the demands of quick and continuous service delivery.
- They require little computation, so they can be installed on machines with few resources, therefore with a lower cost.
- They support horizontal growth, i.e., they tolerate distributed architectures, allowing the installation of new operating nodes that balance workload. With this, expanding the capacity of a database requires very little time.
- They allow handling large amounts of data and storing data of any type at any time, without requiring validation.
However, they present the following disadvantages when compared to relational ones:
- They do not comply with the properties of atomicity, consistency, integrity, and durability (ACID).
- Since NoSQL technology is quite new, operations can be limited, requiring more time to invest in developments.
- There is no defined standard among the different engines that offer this service, and thus, the language to be used changes depending on the chosen NoSQL solution.
- Most NoSQL databases do not have a graphical interface for administration; they usually have access by console, requiring broad knowledge of the necessary instructions to maintain them.
Conclusions
NoSQL databases do not replace relational databases. For each application, it is necessary to evaluate which database solution is more appropriate. Therefore, we can choose a NoSQL database when:
- The volume of data to be stored grows very quickly at specific times.
- The scalability required by a relational database solution is not technically or cost-wise feasible for the project.
- When each data insertion can have different fields of information stored, i.e., the information schema is not homogeneous.
However, the solution with relational databases remains the most appropriate when the integrity, validity, and consistency of the data are key within the organisation.