Azure Cosmos DB - Part One - Introduction To The World Of NOSQL

Introduction 

 
At Build 2017, Microsoft announced a new Service known as Cosmos Db and moved the Document Db as a subset of it. Along with that, they introduced the MongoDb API, Column Based, Key Value Pair and Graph Database to Azure with Cosmos Db.
 
Before going in depth into CosmosDb , we need to understand what NoSql is and how it’s different from SQL . Along with that let’s look at the scenario where we should take on the NoSql Stack over Sql Stack.
 
Relational Database came into existence around 40 years back and they have been sstoring the data for a long time ,so why is there new buzz about NoSql?
 
NoSql is Not OnlySQL and before going any further I want to clarify that most developers think that here SQL is the Microsoft SQL server which is a relational Db offering from Microsoft but instead here Sql represents the traditional relational databases like Oracle, SqlServer, MySql etc. Coming back to the NOSql the terminology comes into the picture due to the change of the type of data which is unstructured.
 
It is not built on tables and does not employ SQL to manipulate data. It also may not provide full ACID (atomicity, consistency, isolation, durability) guarantees, but still has a distributed and fault tolerant architecture.
 
Why NoSQL? It's high performance with high availability, and offers rich query language and easy scalability.
 

Sql Vs No Sql

 
SQL
 
Developers are working with applications that create massive volumes of new, rapidly changing data types — structured, semi-structured, unstructured and polymorphic data.
  • Applications that once served a finite audience are now delivered as services that must be always-on, accessible from many different devices and scaled globally to millions of users.
     
  • Organizations are now turning to scale-out architectures (adding more servers instead of the Increasing the power) using open source software, commodity servers and cloud computing instead of large monolithic servers and storage infrastructure.
     
  • SQL works on ATOMIC Transaction, which means it's all or nothing- either the transaction is going to be successful or a failure. For example, in an ATM transaction the money will either be withdrawn and it should be immediately updated to all the servers whereas NOSQL works on the concept of eventual consistency which means that eventually the data will be updated to all the servers due to the distributed architecture but meanwhile the client can get the old data.
     
  • Programming for SQL is basically difficult for programmers as it converts the models into database tables and you need to maintain the relationships between the tables whereas NOSQL is comparatively easier as it directly turns your models into database entity and doesn’t need to maintain the relationships.
     
  • For Example. If we have a car and we dissemble it and keep all the tires, seats, and engine in one place and on requirement we assemble it and run the car it’s an example of SQL; whereas if you keep one car and park it in a parking lot and simply take that car out of the parking lot it is basically an entity in NOSQL
     
    SQL
Document databases pair each key with a complex data structure known as a document. Documents can contain many different key-value pairs, or key-array pairs, or even nested documents.
 
Graph stores 
are used to store information about networks of data, such as social connections. Graph examples are Gremlin, Neo4J and Giraph. If you have seen people you may know in the social networks like facebook, linkedin etc they uses Graph to get the connections and draw a graph between them and tell the mutual friends to show you how two node(people) are connected.
 
Key-value stores are the simplest NoSQL databases. Every single item in the database is stored as an attribute name (or 'key') with its value. Some key-value stores, such as Redis and azure storage.
 
Wide-column
stores such as Cassandra and HBase are optimized for queries over large datasets, and store columns of data together, instead of rows.
 

SUMMARY

 
“NoSQL” is more of a marketing buzzword, and actually means “no requirement for entity relationships and secondary indexing” in order to query information. It is suitable where there is no predefined schema and you need distributed architecture. It is suitable for scenarios like IOT, Cloud oriented apps, social networks, analytics etc. Also, there are 4 type of Databases – Document, Graph, Key Value Store and Wide Column DBs.


Similar Articles