What are the best non-SQL databases

NoSQL at a glance

The rise of NoSQL databases challenges the traditional relational database model as the solution to all problems - not just in theory but in practice as well. At its core, NoSQL does not mean a fundamental rejection of SQL: NoSQL stands for "Not Only SQL" (not just SQL) than for "No SQL" (no SQL). Interestingly, the new trend takes up database models that have been forgotten in the past for a variety of reasons. The innovation takes place primarily through practical developments - often on the basis of open source software - and not in the form of database theoretical considerations. NoSQL, which I have already mentioned, is not a magic bullet for all database requirements.

The current NoSQL trend is not the first time that the relational SQL database has come under fire. In the 1990s, for example, object-oriented databases made a name for themselves. At first glance, they offered developers a way out of the laborious process of converting their data objects into rows and columns. In practice, however, the implementations of object-oriented databases were often very complex and fragile, so that disaffected developers began looking for better options again. As a result, the object-relational mapper (ORM) emerged, which did a large part of the conversion work of data objects for storage in an SQL database.

The current NoSQL databases have a few features in common: They usually do without the rigid schemas of the tables of their relational counterparts. As schema-free databases, they use more flexible techniques to determine how data is stored; or you leave that completely to the applications. It is named after the use of protocols other than SQL for communication with the clients. The architecture of many NoSQL databases is designed for scalability, so that large amounts of data can be managed in a cluster of standard systems instead of being stored on a single super server.

On closer inspection, the various NoSQL versions can be divided into four main categories: document-oriented databases ("document stores"), key-value databases, column-oriented databases and graph databases.

Document-oriented databases: CouchDB

Document-oriented databases store "texts" of any length with unstructured information and enable searches based on document content. An example document would be the following:

The stored documents do not have to contain the same fields: a database query for would only find documents that contain the field "First Name" with the value "Wallace". XML databases are document-oriented databases with semi-structured data.

CouchDB is a typical representative of the document-oriented genre. The database stores documents as in the example above. Queries - so-called views - are defined in CouchDB with the help of Javascript functions. When called, they create entries in an index. Views can contain a "Reduce" function that prepares the search results as a sorted list for further filtering or evaluation.

The views themselves are stored on the server as CouchDB documents. They can be reactivated and updated at any time. By keeping the results available, the server load can be reduced.

As a distributed database system with an efficient replication mechanism between different systems, CouchDB can be easily scaled. The replication also works with systems that are not always online. Canonical's storage service Ubuntu One, for example, relies on CouchDB to synchronize data between client PCs. The BBC also uses the database as an internal data storage facility for the various web services of the English radio and television broadcaster.

More information about CouchDB can be found in the English-language CouchDB book and on the CouchDB website, which is located under the umbrella of the Apache Foundation.

Graph databases: Neo4J

One of the most resource-intensive and complicated things that can be stored in an SQL database is the relationship between different elements - for example the network of friends, followers, etc. in a social network. It may take multiple queries in an SQL database to iterate over a relationship.

Graph databases focus on representing data as nodes and relationships between nodes. Neo4J is an example of this type of database. Instead of conventional data sets, nodes are created here, which are linked to one another through the relationships that are defined between them. An example in Java code:

Two nodes are created here. A relationship OWNS - "owns" - exists between these two elements, which is defined elsewhere as a simple enum.

Information about the nodes and their relationships are saved as properties:

The first knot (Wallace) owns the second knot (Grommit) - he pays dog tax. Based on this simple model, it is easy to create graphs of relationships that can be easily traversed.

Another example of a graph database is FlockDB, a creation of the Twitter developers. It was specially created to show who is following whom on the microblogging platform.

Graph databases show their strengths in the representation of elements in which the relationships to one another are the focus. It is true that non-relational information can also be stored in a graph database, but the question quickly arises as to how useful this is.

More information on Neo4J can be found on the project's website.