DEV Community

GhostVaibhav
GhostVaibhav

Posted on

But, what is a graph database?

Umm..., as the name suggests a graph database consists of a graph. Obviously! However, the actual data is stored in the vertices and their relationships are represented as edges. That is what forms the graph. This graph could be previewed in many databases including AgensGraph. Getting this graph preview for a database storing millions of vertices and billions of edges may not mean anything, as you mentally can't think about the scale of that data. While you can't, computers can! So, in this article, I will be discussing some advantages of these graph databases and their use cases.

1. Schema-less

As the title itself suggests, a graph database doesn't have a fixed schema. Since the graph databases store data as objects instead of inserting them into tables, the capacity is increased and various formats are accepted.

A large amount of data can be stored. Also, the data element can be both independent and dependent, allowing for better operability. With this, the graph databases are quite flexible in their design. For example, consider adding a new column to an existing table, you would need to know the underlying structure of the database, the foreign key, any constraints, views, etc. With graph databases, inserting a vertex is as simple as it can get. You can also easily connect as well as disconnect it from any number of vertices. Furthermore, these vertices can have single or multiple labels associated with them for even more granular control.

2. Query Processing Speed

The conventional databases need to execute a join for displaying relationships between any two tables. This is a very costly operation. Also, if we have to have more depth to it, like, we have to multiple join operations, the complexity would just multiply.

This is where the graph databases take over the conventional databases. Finding the relationships in a graph database is much simpler and faster in comparison since they are purpose-built for this kind of use case. The difference becomes more pronounced when executing deep-level joins.

3. Intuitive Modeling

The heading itself describes the whole problem. When we take a real-life problem, we have to model it in a whole new way just to fix it through conventional database systems. While this is doable, when the use cases increase, the complexity rises steeply. Graph databases excel in this field as well. Whatever the real-world problem may be, you will always be able to convert it into a graph database and represent it through a set of vertices and edges.

On an ending note, I would like to clarify that, graph databases are built for specific use cases. If your use case lies close to those, consider switching over to them, else, you can always fall back to the industry standard conventional databases.

This was all for the article. Until then, see ya!

Top comments (0)