NoSQL

SeanUdayantha
5 min readMar 17, 2022

--

What is a NoSQL database?

When individuals say “NoSQL database,” they’re usually referring to any database that isn’t relational. Some people claim “NoSQL” means “not only SQL,” while others say it means “non SQL.” In any case, most people believe that NoSQL databases are databases that don’t use relational tables to store data.

History of NoSQL databases

Relational databases were first, and thus provide a good reference for understanding non-relational databases. The relational database, invented by Edgar F. Codd in 1970, divides data into rows and columns by assigning a unique key to each row. Almost all relational database systems are quite complicated and employ Structured Query Language (SQL). They are typically more rigid or regulated systems with limited or limited capacity to convert complicated data such as unstructured data. However, SQL systems are still widely used and extremely valuable in enterprises of all sizes for preserving reliable transactional records, historical data sources, and a variety of other use cases.

Why NoSQL?

Almost every business makes use of NoSQL databases. The use cases range from the really important (e.g., keeping financial data and healthcare information) to the more amusing and frivolous (e.g., storing IoT readings from a smart kitty litter box).

In the sections that follow, we’ll look at when you should utilize a NoSQL database and common misunderstandings concerning NoSQL databases.

Types of NoSQL

Document databases, key-value databases, wide-column stores, and graph databases are the four primary types of NoSQL databases that have evolved over time.

Document databases

A “document” is the core idea of a document repository. While the specifics of this definition vary amongst document-oriented databases, all of them presume that documents contain and encode data (or information) in some common formats or encodings. Encodings in use include XML, YAML, and JSON, as well as binary versions such as BSON. In the database, documents are identified by a unique key that represents that document. Another distinguishing feature of a document-oriented database is the use of an API or query language to retrieve documents based on their content.

Different implementations offer different ways of organizing and/or grouping documents:

  • Collections
  • Tags
  • Non-visible metadata
  • Directory hierarchies

Collections are equivalent to tables in relational databases, while documents are analogous to records. However, they vary in that every entry in a table has the same sequence of elements, whereas documents in a collection may have totally different fields.

Key-value databases

The associative array (also known as a map or dictionary) is the fundamental data model of key–value (KV) stores. Data is represented as a collection of key–value pairs in this paradigm, with each potential key appearing only once in the collection.

The key–value model is one of the most basic non-trivial data models, and it is frequently used as a foundation for more complex data models. The key–value model can be expanded to a discretely ordered model in which keys are kept in lexicographic order. This addition is computationally strong in that it can obtain specific key ranges quickly.

Wide-column stores

store data in tables, rows, and dynamic columns.

Graph databases

Graph databases are intended for data whose relationships may be represented as a graph of items connected by a finite number of connections. Data examples include social ties, public transportation linkages, road maps, network topologies, and so on.

RDBMS and NoSQL databases

While there are many differences between relational database management systems (RDBMS) and NoSQL databases, one of the most important is how data is represented in the database. In this part, we’ll look at how to model the same data in a relational database and a NoSQL database. Then, we’ll go through some of the other significant distinctions between relational and NoSQL databases.

RDBMS

NoSQL databases

When should you utilize NoSQL?

When considering which database to utilize, most decision-makers discover that one or more of the following considerations cause them to choose a NoSQL database:

  • Fast-paced Agile development
  • Storage of structured and semi-structured data
  • Huge volumes of data
  • Requirements for scale-out architecture
  • Modern application paradigms like microservices and real-time streaming

NoSQL database misconceptions

Many misunderstandings concerning NoSQL databases have proliferated among the developer community over the years. In this part, we’ll go through two of the most frequent myths:

  • Relationship data is best suited for relational databases.

A prevalent fallacy is that NoSQL databases, also known as non-relational databases, are incapable of storing relationship data. Relationship data can be stored in NoSQL databases; it is just stored in a different way than it is in relational databases.

In fact, many people believe that modeling relationship data in NoSQL databases is easier than in relational databases since related data does not have to be separated between tables. NoSQL data structures allow for the nesting of related data within a single data structure.

  • NoSQL databases don’t support ACID transactions.

Another widely held belief is that NoSQL databases do not handle ACID transactions. Some NoSQL databases, such as MongoDB, do support ACID transactions.

It is worth noting that the way data is represented in NoSQL databases might reduce the requirement for multi-record transactions in many use scenarios. Consider the previous example, in which we saved information on a user and their interests in both a relational and a document database. To ensure that information about a person and their interests were updated in a relational database at the same time, we’d need to employ a transaction to change entries in two tables. In a document database, we could perform the same thing by updating a single document — no multi-record transaction necessary.

NoSQL databases provide a variety of benefits including flexible data models, horizontal scaling, lightning fast queries, and ease of use for developers. NoSQL databases come in a variety of types including document databases, key-values databases, wide-column stores, and graph databases.

--

--