NoSQL is not one technology. It refers to a wide variety of different database technologies that address scale and agility challenges of today’s applications. These problems include:

  • agile development where data types change over iterations
  • applications delivered as services with distributed storage
  • maturity of cloud computing
  • maturity of big data
  • coming of age of client side applications

Relational databases are still the work horses of the software industry. However, it has a few disadvantages. It requires developer to more or less finalize their data model and schema before application development. NoSQL is very flexible. NoSQL databases allow data insertion without predefined schema.

Applications cannot install an SQL server on a client’s iPhone. NoSQL database are lightweight and file based (usually JSON) and can easily be placed in client devices. Client-side applications are adding new level of interactivity to web interfaces. These are more easily accomplished with NoSQL databases.

NoSQL databases can be distributed across geographical locations with ease. This plays nicely with cloud computing. The same can be done with relational databases but it is difficult and expense, requiring specialized hardware and software.

There are many different types of NoSQL databases with specific strengths.

Key/Value based NoSQL Databases

Each record is a key/value pair. There is no structure and no relation. The key/value pairs are organized in a dictionary. Inserting data is an addition to this dictionary. Data retreival is a search in the dictionary. They are typically used for storing basic information. They are very fast, efficent, and easily scalable. This technology is idea for quick and frequent lookup functionality such as caching, queueing, to maintain state, and distributed storage. Redis and MemcacheDB are examples of key/value based NoSQL databases.

Column based NoSQL Databases

These databases work by creating collections of key/value pairs. Each record comes with one or more columns containing key/value pairs. The columns can contain completely different types of data. You can think of it as a two-dimensional array where each record has one or more key/value pairs attached to it. Column based NoSQL databases can better handle very large complex data than key/value based databases. They are schema-less and highly scalable. They are ideal for storing massive quantities of data. Cassandra and HBase are examples of column based NoSQL databases.

Document based NoSQL Databases

Docment based NoSQL databases work like column based NoSQL databases but allow more complex nesting. Each record is called a document and you can nest documents as well. The price you pay for this flexibility and power is performance reduction as the data increases in size and complexity. These databases great for storing complex nested data. Data is stored in JSON so it is JavaScript friendly. This makes these databases the de facto choice for client-side web applications. MongoDB and Couchbase are examples of document based NoSQL databases.

Graph

Stores content in a graph. This makes some tasks very fast while other very expensive. Generally, this is more suitable for map and network type functionality. These databases are great for complex relational information and to handle classification problems. OrientDB and Neo4J are examples of Graph based NoSQL databases.

When to use NoSQL databases

Consider using NoSQL databases:

  • if you are building new application
  • if you are building a client-side application
  • if you are have not worked out the final data model and schema
  • if you are doing agile development
  • if size and speed matters
  • if you will be hosting in a cloud
  • if you are interested in benefits offered by a specific NoSQL database