DEV Community

Sagar R Ravkhande
Sagar R Ravkhande

Posted on

What is a NoSQL database?

The term NoSQL is used to describe a set of technologies for data
storage. In this section, I explain what NoSQL is, outline the
major types of NoSQL databases, and compare NoSQL to relational
databases.

Defining NoSQL

NoSQL describes technologies for data storage, but what exactly
does that mean? Is NoSQL an abbreviation for something?
Depending on whom you ask, NoSQL may stand for “not only SQL” or it may not stand for anything at all. Regardless of any 4 Redis disagreement over what NoSQL stands for, everyone agrees that
NoSQL is a robust set of technologies that enable data persistence
with the high performance necessary for today’s Internet-scale
applications.

SQL is an abbreviation for Standard Query Language, a standard
language for manipulating data within a relational database.

Identifying types of NoSQL databases

There are four major types of NoSQL databases — key/value,
column, document, and graph — and each has a particular use case for which it’s most suited.
The following sections go into greater detail on the four types of
NoSQL.

Key/value

With a key/value storage format, data uses keys, which are identifiers that are similar to a primary key in a relational database. The data element itself is then the value that corresponds to the key.

Use cases include shopping carts, user preferences, and user profiles.

An example of a key/value pair looks like this:

"id": 123456
Enter fullscreen mode Exit fullscreen mode

In this example, "id" is the key while 123456 is the value that
corresponds to that key.

Key features of the key-value store:

  • Simplicity.
  • Scalability.
  • Speed.

Column

With a column-oriented data store, data is arranged by column
rather than by row. The effect of this architectural design is that it makes aggregate queries over large amounts of data much faster to process.

Use cases include analytics.

Key features of columnar-oriented database:

  • Scalability.
  • Compression.
  • Very responsive.

Document

Document data storage in NoSQL uses a key as the basis for item retrieval. The key then corresponds to a more complex data structure called a document, which contains the data elements for
a given collection of data.

Use cases include eCommerce platforms, trading platforms, and mobile app development across industries.

Key features of documents database:

  • Flexible schema: Documents in the database has a flexible schema. It means the documents in the database need not be the same schema.
  • Faster creation and maintenance: the creation of documents is easy and minimal maintenance is required once we create the document.
  • No foreign keys: There is no dynamic relationship between two documents so documents can be independent of one another. So, there is no requirement for a foreign key in a document database.
  • Open formats: To build a document we use XML, JSON, and others.

Graph

Graph databases use graph theory to store data relations in a series of vertices with edges, making queries that work with data
in such a manner much faster.

Use cases include fraud detection, social networks, and knowledge graphs.

Key features of graph database:

  • In a graph-based database, it is easy to identify the relationship between the data by using the links.
  • The Query’s output is real-time results.
  • The speed depends upon the number of relationships among the database elements.

Comparison between NoSQL and relational databases

Regardless of the type of NoSQL database, the patterns, and tools that you use to work with data are different from the patterns and tools that you typically find with a relational database. As you just saw, the paradigm for storage and arrangement of the data typically requires a rethink of how applications are created.
Relational databases connect data elements through relations between tables. These relations become quite complex for many applications, and the resulting queries against the data become equally complex. The inherent complexity leads to performance issues for queries.

Many traditional databases include query tools and software to directly manipulate data. With NoSQL, most access will be programmatic only, through applications that you write using the tools and application programming interfaces (APIs) for the NoSQL database.

Relational databases have somewhat less flexibility than a multi-model databases such as Redis. Whereas a relational database thrives when data is consistent and well structured, Redis and NoSQL thrives on the unstructured data that is found in today’s modern applications while also providing the flexibility to structure data as needed.

Why use NoSQL Databases?

why Nosql

Different NoSQL Database models

NoSql DB Models

Top comments (0)