Friday, September 7, 2012

How to Make choice between Relation Database and NoSQL/Document Database?


Very Quick introduction to NoSQL

We are not going into details of what NoSQL is? but brief introduction about NoSQL make sense so it is as follows:

NoSQL is database management systems which is not adhered to relational database management systems and hence does not requires the SQL for accessing its data. Usually data is stored as documents. NoSQL database management systems is optimized for storing retrieving large amount of data. As data is not stored across different tables, there is no need not to put the joins across different tables to fetch the data and this provides more speed and scalability in NoSQL databases.

You can find more about NoSQL Data at Wiki and nosql-database.org
                                                                                                                                                    
How to make choice between the two

Important question here is when to use NoSQL and when to use Relational database or How to make choice between the two?
To answer the question we need to use the CPA theorem. CPA theorem specifies  (from wiki)

" It is impossible for a distributed computer system to simultaneously provide all three of the following guarantees
Consistency, Availability, Partition tolerance "

So we need to decide what is important in our case, If Consistency is critical and most required then choose relational database. example is banking application where consistency is most  important and we cannot show stale data and we cannot miss single update.

If Availability is more important then choose NoSQL Database , for example in some cases it is more important to having some data then waiting for long time and/or going offline.

1 comment:

Anonymous said...

This blog helped me lot to take decsion

--Ninad P