Anurag Kale
Data On Cloud - By Anurag Kale


Data On Cloud - By Anurag Kale


What is NoSQL ? - Part 1

Anurag Kale's photo
Anurag Kale
·Aug 25, 2020·

3 min read

In very simple terms, a database which does not store data the way relational databases does can be termed as a NoSQL database. I am not kidding. You can see the definition of NoSQL on Wikipedia. It says the same thing in a bit nerdy way.

“A NOSQL provides a mechanism for storage and retrieval of data that is modelled in means other than tabular relations used in relational databases" - Wikipedia

So what does this mean for a developer, admin, tester or any techie? The data is stored in a format which does not include structure of tables, primary keys, foreign keys etc. There are however many types of NoSQL databases. They are broadly categorised into 4 buckets.

Lets take a look at each of them.

Types of NoSQL Databases

  1. Key Value Stores
  2. Document Databases
  3. Column oriented databases / wide column databases
  4. Graph Databases


Image Source :

A Key Value Store

As the name suggests there are two components to the structure in which the data is stored, the key and its corresponding value. Its also referred to as a KV store.

A key value store can be imagined as a dictionary data type in Python.

MobilePhones = { 1:'Apple', 2:'Samsung',3:'LG', 4:'OnePlus' }

The numbers 1,2,3,4 are the keys and Apple, Samsung, LG and OnePlus are the values. In KV stores though,the values could be a bit complex like SET,a LIST etc. So it would ultimately look like

"MobileManufacturer" : ["Apple", "Samsung"]
"CommonNames" : ("Katie", "Lauren", "Jeff", "Tam")
"Continents"  : ["Asia", "North America","South America" ,"Europe", "Africa","Antartica","Austrailia"]

So what makes KV stores special? The speed with which they can retrieve and store data.

Let say you wanted to access the continent names, you can directly ask the database to pull the key - "Continents" and it will do it in BigO(1) or constant time irrespective of the database size. Mind that you have specified the key that you wanted. This is where the magic of hash functions come into picture. Using hash values, you get a great read and write speed. Read more about Hash Functions here.

Typical usage of Key Value stores is seen in caching applications like Redis Cache, Memcache and applications where the data consumption and creations follows a fixed pattern. Your application code will also have to be coded to be compatible with the type of data-structure the Value part returns and must be able to process and consume it. Typically you get sub millisecond response time for reading or writing to the KV stores if used correctly.

What makes KV stores so fast?

  • Array like direct access using keys
  • Use of Hash functions to evaluate the Key value

More on the next 3 types of NoSQL in upcoming posts. Stay tuned.

Share this