NoSQL Solution Series – Part 2
Now that we have already looked at what NoSQL is, let us try to look into the classifications of NoSQL in this part. There are 4 basic types of NoSQL and the same are listed below:
Key-value: These are the simplest form of NoSQL databases. Every entry is stored as a key-value pair.
Examples of this database includes FoundationDB, Redis, Riak etc. Some key-value databases such as Redis allow each value to have a type, such as “integer”.
Document Database: Don’t think of this as some document repository like SharePoint!. The notion here is that each key is tied to a complex data structure. This complex data structure is referred to as a “document”. Now the complex data structure could be XML, JSON etc. The document database offers query languages or APIs that allows you to retrieve documents based on their content. Examples of this database include MongoDB, CouchDB etc
Column Store: Column stores are similar to Key-Value defined above in that it works on the principle of a key for retrieving the value. But the value in a column store can have multiple columns. Column store does not have the concept of defined rows like in a relational database. One row could contain one, many or some columns. This makes adding new columns easier and also keeps all associated data together. Thus it helps in quicker retrieval but if aggregation of data is required, then it needs Map-Reduce jobs. Examples of Column store are HBase, Cassandra etc.
Graph Database: This type of database is particularly useful when there is a lot of ‘relationship’ between the data. For example, social relationship, road maps, network topologies etc have high degree of interconnection between data. These type of data can be stored in a Graph database. Its very similar to relational DB in the sense that it has nodes (records), properties (column data) & edge (relationship – foreign keys). You might ask, ‘well isn’t this then a relational DB?’. The edges in Graph DB is a different from a relational DB in that it not only stores relation but it can also store properties that define the relationship. This is where Graph DB edges ahead of Relational DB. Where we traditionally use joins and compromise on performance, Graph Database can find relationships between highly interconnected data very fast. Examples of Graph DB includes NEO4J & HyperGraph DB.
Now that we know the 4 different types of NoSQL it would become obvious to you that simply selecting MongoDB or HBase or Cassandra for your solution (because they are popular) is not the right approach. You should be completely aware of the merits of these four classifications and select the right classification applicable for your business scenario and then select the technology solution that you are going to use.
In the next section, let us try to answer the important question – when to use which NoSQL classification? Till then adios..