NoSQL

NoSQL

Some of you know the story and some don’t. NoSQL means Not Only SQL. This is referring to the kind of databases that work on abstractions other than SQL (Structured Query Language). SQL was used with our good old RDBMS (Relational Database Management Systems) like ORACLE (although ORACLE now has a NoSQL offering), MySQL, Postgre SQL etc. Come to think of it, SQL is a really cool language. English like. However, the problem with RDBMS is that they don’t scale very well. If your website goes from 10 users to 10,000 in a day and sustains the momentum, then your database must scale well to handle this extra load. Despite having features like indexes (which are only for query – indexes slow down inserts/updates and deletes), clusters and others, an RDBMS can only grow vertically (boosting up the same machine with more RAM, More CPU’s etc) and not much horizontally.

As we came across the limit, smart programmers at companies like Google and Facebook thought of the big problem of handling this enormous amount of data, which we call ‘Big Data’. They came up with other design abstractions and from them and many millions of other programmers, designers came up 4 NoSQL offerings:

  • NoSQL Types

    Types of NoSQL

 

  • Key-Value Oriented Databases
  • Column Oriented Databases
  • Document-Oriented Databases
  • Graph Databases

 

Key-Value Oriented Databases

Store information as Key: Value. For example, Name: Rajesh, Age: 50 and so on. You can store lots of information in these kinds of databases. Eg: Riak, ReDis.

Strengths

  • Simple data model
  • Horizontally scalable

Weaknesses

  • Simple data model
  • Poor at handling complex data

Column Oriented Databases

Store information in columns (unlike RDBMS which stores information in rows). Eg: HBase, Cassandra.

Strengths

  • The data model supports semi-structured data
  • Naturally indexed (columns)
  • Horizontally scalable

Weaknesses

  • Does not handle interconnected data well

Document-Oriented Databases

Store information as documents (equivalent to rows). They are like Key-Value but can store more data. Think of them as Key: Document. The database can take in different kinds of documents in one collection (table). Eg: MongoDB, Couch DB

Strengths

  • A simple, but powerful data model
  • Good scalability

Weaknesses

  • Does not handle interconnected data well
  • Querying is limited to keys and indexes
  • MapReduce for large queries

Graph Databases

Store information in nodes and relationships. Are highly effective when you have traversals. All your social media like Facebook use Graph databases. Eg: Neo4J, AllegroGraph

Strengths

  • An extremely powerful data model
  • Performant when querying interconnected data
  • Easy to query

Weaknesses

  • Sharding (dividing your database into logical parts)
  • Rewiring your brain (if one node changes, it can affect a lot more)

Well, these are the types of NoSQL. Now you have Hadoop (Database – Hadoop Distributed File System and Algorithm – Map Reduce and others) and Spark (Hadoop with In-memory database) and many more.

A combination of NoSQL, SQL, and Hadoop like backbone can address many use cases. The big question is of integration.

Some people use a term called ‘Polyglot Persistence’ which is a term used for multiple databases and languages for writing an application.

Today there are too many standards, but the world is moving to Open. Technology Nirvana – Not far away.

Cheers !

God Bless !