NoSQL is a type of datastore; it's a way of storing and retrieving data quickly, much like a relational database except it isn't based on the mathematical relationship between tables as a traditional relational database does. NoSQL datastores can be much faster than relational databases but generally lack the robustness that those provide for the speed. The growth of ultra large websites like Facebook and Google has lead to the development of NoSQl as a way of breaking through the speed constraints that relational databases provide. Most work on storing and fetching Key-Values, though some e.g. redis, store large quantities of data entities (called documents) in XML or JSON format.
Types Of Nosql Databases
There are four main types of NoSQL databases:
* The basic key/value store performs nothing other than the function described above – taking a binary data object, associating it with a key, and storing it in the database for later retrieval. * Document stores go beyond this slightly by imposing a little more structure on the binary object. The objects must be documents, encoded in some recognizable format, such as XML or PDF, but there are no requirements about the structure or content of the document. Each document is stored as the value portion of a key/value store and may be accompanied by metadata embedded in the document itself. * Columnar databases are a hybrid between NoSQL and relational databases. They provide some row-and-column structure, but do not have the strict rules of relational databases. * Graph databases store information in multi-attribute tuples that reflect relationships in a different way. For example, a graph database might be used to store the "friend" relationships of a social network, with a record merely consisting of two friends who share a relationship.
The current NoSQL world fits into 4 basic categories.
1. Key-values Stores
2. Column Family Stores
3. Document Databases
4. Graph Databases
1. Key-values Stores are based primarily on Amazon's Dynamo Paper which was written in 2007. The main idea is the existence of a hash table where there is a unique key and a pointer to a particular item of data. These mappings are usually accompanied by cache mechanisms to maximize performance. 2. Column Family Stores were created to store and process very large amounts of data distributed over many machines. There are still keys but they point to multiple columns. In the case of BigTable (Google's Column Family NoSQL model), rows are identified by a row key with the data sorted and stored by this key. The columns are arranged by column family. 3. Document Databases were inspired by Lotus Notes and are similar to key-value stores. The model is basically versioned documents that are collections of other key-value collections. The semi-structured documents are stored in formats like JSON. 4. Graph Databases are built with nodes, relationships between notes and the properties of nodes. Instead of tables of rows and columns and the rigid structure of SQL, a flexible graph model is used which can scale across many machines. Nosql Architecture
The core of the NoSQL database is the hash function – a mathematical algorithm that takes a variable length input and produces a consistent, fixed-length output. The key of each key/value pair being fed to a NoSQL database is hashed and this hash value is used to direct the pair to a particular NoSQL database server, where the record is stored for later retrieval.
When an application wishes to retrieve a key value pair, it provides the database with the key. This key is then hashed again to determine the appropriate server where the data would be stored (if the key exists in the database) and then the database engine retrieves the key/value pair from that server.
As you read the description of this process, you may find yourself wondering “How does the user or...