SQL vs NoSQL
Most of the databases in use today are Relational Databases which are queried by SQL. These databases are characterised by organisation of data in rows and columns. At the Application level we characterize data by objects and classes so there is a discrepancy when we want to store such data in Databases. We have to convert them in tables. This task is normally done by RDMS systems. The disconnect between the data at application level and at persistence level is called impedence mismatch.
NoSQl Databases( Not only Sql databases) are intended to resolve such mismatch. NoSQl databases like Cassandra, Memcache favour scaling out rather than scaling in. Also with NoSQl Databases we can customize a particular record to contain unique fields. Of course this must have backward and forward compatibility.
Also NoSQL databases favour locality over SQL Databases. A SQL databases is often sharded which leads to multiple index look up to find a particular item. Whereas for NoSQl all pieces of a certain record are stored in contiguous memory location. This leads to faster response times. NoSQL databases also cater very well to semi structured data which are in abundance nowadays. The NoSQl database provide what is known as Schema on read. That is when you try to read data you need to provide logic in Application Layer. NoSQL databases can be of various types
- Document databases where records are stored as JSON or in XML format
- Graph Databases where nodes are records and edges determine relationships between different records . The relationships can be many to one one to one, one to many etc