DB

SQL Vs No SQL

Choosing the NoSQL Database

    • Some examples - Graph-base, mongoDB, CouchDB, Neo4j, Cassandra, Hadoop

    • NoSql technology is new around ~2008. It is safe to say there are no defined standards related to NoSql DB

    • NoSql database most popularly gets categorized into 4 types

    • Key-Value Store

    • Document Based Store

    • Column Based Store

    • Graph Based

Key Value Store NoSql Database

    • Uses a hashtable to store unique key and pointers to each data value, which in turn data is stored in schema less way

    • There are no complex relations thus implementation is very easy, and since these databases only use a single primary key as access

    • They give great performance and can be very easily scaled

    • These DB are utilized for storing user-sessions, user preferences, user-profiles schemaless

    • These DB are avoided for query DB for specific data value, need relationships between data value, need to operate on multiple keys

    • Examples are Redis, Riak, FoundationDB

Document Store NoSql Database

    • Imagine a Key-Value database in which instead of storing the 'value' we are storing entire documents

    • These documents are mainly stored in common notation formats like XML, JSON, BSON, therefore give greater flexibility in querying

    • These embeds attribute metadata related to the stored content with each document because of which you can search data by primary key and value in documents

    • These DB are useful with content management system, Blogging platform, Analytics platform, E-commerce platform

    • These DB are avoided for complex search queries, the information in document needs to be queried and matched very frequently

    • Examples are CouchDB, MongoDB, CouchbaseDB

Column Store NoSql Database

    • These are row based databases

    • Data is stored in rows, that have a unique row-id, and the data is stored in form of flexible coulmns

    • Because of its similarity to SQL DB, column store are easier to query. But they are not as flexible in storing random information

    • Key difference between Column Store Vs SQL is that in Cloumn Store you dont have to maintain consistent column numbers. You can add a new column to any row without having to add them to all the rows of DB

    • These DB are useful with content management system, Blogging platform

    • These DB are avoided for complex queries, need to store arbitrary data very fast

    • Examples are Apache HBase, Cassandra, Hadoop

Graph Based NoSql Database

    • These are all about edge-nodes and graph relations. You store data entities and allow users to add relations to these database entities

    • However database neither knows nor care what is stored in data entities or how it is stored

    • The database used complex graph structures complete with the ability to define edges, nodes and node properties.

    • This not only gives greater abilities in querying relational data but also provide index-free searches, a problem that plagues previously mentioned NoSQL types.

    • These are enormously useful in applications that have connected data, such as social networks

    • These DB are avoided for complex search queries and relation-less data

    • Examples: Titan, OrientDB, Neo4j, Infinite Graph

The Combination Solutions

    • Though there are various types of databases, it is not advisable nor is it the norm to opt for single database.

    • More popularly, and as much sensibly, its the idea of using more than one database which does the trick

    • For example in a social network app it is best to use a Graph Database to manage connections and Document Database for managing profile and post data.

    • For best solution, let database expects study and come-up with the solution for you

References