Difference between non-relational database models

Asked

Viewed 820 times

6

When it comes to non-relational databases, we have some options, such as the Document database and Graph database.

Regarding the two, what are the main differences and benefits of using each?

2 answers

8


As its name says a document-oriented database has as its database a document with all the information it needs about it. Even related data is usually in the document itself and you have collections of these documents. Already I talked about Mongodb, the most used in this model. Viewing:

Document

A graph-based database has as its strong point the relationships between the various objects and these relations can occur in many ways, there is not much rule of how they relate. I I’ve answered that before. Visualizing:

Grafo

The two are opposed to the relational model that has more rigid documents (tables) (this is no longer so true in more modern systems) and relationships between these data more narrowly, which can be advantageous at one point and disadvantageous at another. Some products that were pure relational databases now work with multi-model and there are already non-relational databases adopting more than one model, so this idea of separating products by models starts to get more nebulous. Adopt the model that best fits the problem (not the one you like to work with the most) and see which products fit this. Since most applications require more than one model, the best products are those that meet this demand natively.

6

I actually know four major types:

  • Key value: is precisely what the name describes you have a key and a value, the use is usually for cases where you do searches only by key, it is not possible to search for value, cases of use of this model are usually storage of user sessions and shopping carts, For example, you have the user id which is the key and the cart items or user session information. Banks: Dynamo, Riak.

  • Document: is a type of key value, the big difference is that you have several keys and values and can search for both. The use cases of this template are event logs, content management, blogs and the like. Banks: Mongodb, Apache Couchdb.

  • Column: this is particularly one of the ones I least understand yet and I’m still studying, but the idea here is similar to a relational bank, just the idea of having columns, so you’ll have columns and rows almost similar to a relational bank, Use cases are practically the same as database cases via document, what differentiates one from the other is that here you have to create the "table" with columns while in document database not. Banks Cassandra, Hbase.

  • Graph: this is valid for data models where it is important the relationship between them and the relationship is complex, for example you want to know if João and Maria were in restaurant Y. The most common use cases for this model are social networks and services based on location. Banks: Apache Giraph, Neo4j.

I recommend reading the book: Nosql Distilled by Martin Fowler, I think it has in Portuguese, was one of the first who read and helped me. There’s also a nice talk from him on youtube about it. Although the references are a little old the concepts change a little.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.