In this article, we are going to learn Azure Cosmos DB. This article is a part of the series “Learn NoSQL in Azure”, where we will explore all the different types of non-relational databases that are supported in Azure at the moment. Azure is one of the most popular public cloud platforms that has a big market share all over the world. Cosmos DB is a part of the Databases section in Azure that allows customers to create and use NoSQL or non-relational databases and consume these at scale. You can leverage Cosmos DB to build highly scalable and robust cloud-based applications that support modern big data workloads. Let us understand more about what a NoSQL database is all about and how it is different from a relational database. Although this article focuses on the NoSQL related to Azure, it is to be known that other open-source projects support NoSQL databases like Apache Cassandra, etc. However, these topics are out of the scope of this article and we will focus on Azure mostly.

Why do we need a NoSQL Database?

Overall these decades, developers have been using relational database management systems to develop applications across all domains. Even today, relational databases are used heavily in most modern applications. However, as the applications and databases grew in size, it became difficult for the relational databases to scale and the need for highly scalable databases grew. Applications needed to be highly responsive and available most of the time. Due to these requirements, databases had to be scaled and distributed to achieve high performance and low latency.

However, relational databases were based on relationships, and distributing these databases across multiple systems gets very costly, as these relationships had to be maintained across all the nodes within the cluster. These databases are originally architected to run on single servers in order to maintain the integrity of the databases. This meant that relational databases can be scaled vertically but preferably not horizontally. Vertical scaling could be done by increasing the resources available on the server, but it was limited, unlike horizontal scaling. These limitations gave rise to the evolution of the NoSQL databases as these could be scaled both vertically and horizontally without having to worry about keeping relationships intact.

Introduction to NoSQL Databases

As the name suggests, a NoSQL database is basically a non-relational database. It is different from the fact that data in a NoSQL database is stored in documents as opposed to tables in relational database management systems (RDBMS). Since there are no tables in the database, there aren’t any relationships between the different entities within the database. There are many types of NoSQL databases like Key-Value databases, Columnar Databases, Document Database, Graph Databases, etc. The main form of storage in a NoSQL database is JSON. Let us look at how a NoSQL Database looks like.

As you can see in Figure 1, on the left we have two relational tables – “Orders” and “OrderDetails”. And on the right, we have a JSON document that relates to the structure from the tables. This JSON document is known as a single document in a Document Database. The detailed data from the OrderDetails have been incorporated within the same Orders in a nested form. This is a denormalized form of the data and helps in faster reads as compared to reading data from multiple tables. Here, in a NoSQL database, the data is stored in the form of documents, which means we are going to have one single document for each order. In this way, as the orders increase, they can be distributed to multiple nodes and scaled out accordingly. Notice that since the detailed data are nested within the same document, there is no need to maintain complex relationships within the two entities.

#azure #azure cosmos db #nosql

Learn NoSQL in Azure: An overview of Azure Cosmos DB
1.05 GEEK