A NoSQL (often called Not Only SQL) database provides a mechanism for the storage and retrieval of data that is modelled using data structures rather than the tabular relations used by relational databases which can sometimes be a rigid approach to modelling data.
Here is what our Development Director, Rob Galley, says about NoSQL databases:
“With a client storing thousands of records sparsely populated, a document database (documentdb) or NoSQL database offers an alternative way of both storing and accessing data in a more flexible manner. We are now testing this approach using the documentdb service within Microsoft Azure, which also offers all the advantages of Azure such as scalability and reliability. We will report back on how DocumentDB works in practice in due course”
The NoSQL data structure types include:
- Key Value stores – Key value stores mean that every item in the database is stored as a key, paired together with its value.
- Graph stores – Graph stores can be used to store information about networks, they mean that index lookups are not necessary.
- Document databases – In a document database each key is paired with a document (a complex data structure). Documents can contain lots of key-value pairs.
- Wide Column stores – Wide Column stores are used to find data from large datasets, data is stored in columns together rather than in rows.
Understand the difference with CAP Theorem
CAP Theorem essentially states that a database will generally only excel at two of three things. Those three things are consistency, availability, and patrician.
A relational database excels at consistency and patrician. A NoSQL database however, excels at availability and patrician. This means a NoSQL database may be quicker processing your request, but the data given back may not always be consistent.
NoSQL uses ‘eventual consistency’. This means you are able to put in your request quickly, but all records may not be changed at once. Whereas with a relational database, your request may take longer but the data returned will all be consistent.
A great example of this is websites. When you change where you host your website, and therefore your IP address, some networks and geographic locations may take longer to see the change. So although you have made the change straight away, because of periodic updates your website is not consistent everywhere. Whereas a relational database would make you wait until your website is consistent everywhere before you could process your request.
To put it simply, you are trading-off consistency in a relational database for speed in a NoSQL database.
Would your business benefit from a NoSQL database?
YES – If your data is starting to make no sense in a normal SQL database and you have having to use unwieldy JOIN queries to access a piece of information.
YES – If you are breaking the relational model of your current SQL database.
NO – If your business’ current relational database is working for you.
NO – If your data needs to be structured in a relational manner.