Get startedGet started for free

When to use graph databases

1. When to use graph databases

In this lesson, we are going to learn when graph databases are suitable and when they are not.

2. Suitable cases - General information

In general, graph databases are suitable when dealing with highly connected data. In the following slides, we will discuss several scenarios that are a good fit for graph databases under this condition.

3. Suitable cases - Social graphs

Let's start with social graphs. Social information can be modeled using graph databases. As we saw at the beginning of this chapter, we can store information about social networks, such as the users and their relationships, the posts they write, the likes, etc. Other social interactions can be represented. For instance, we can model the employees of a company, the projects they work on, or relations between the employees.

4. Suitable cases - Infectious diseases

Another suitable case for graph databases is the modeling of infectious diseases. The COVID-19 pandemic has shown how important it is to analyze the world as a whole. Graph databases can be used to model the interactions between people, contact events, or exposures. In this domain, graph databases can help to understand transmission chains.

5. Suitable cases - Location services

Graph databases can also represent locations and distances between these locations. With this information, we can optimize the routes for navigation applications, or we can even provide recommendations for nearby points of interest, like restaurants, cinemas, hospitals, etc.

6. Suitable cases - Fraud detection

Graph databases can help stop fraud scenarios in real-time, such as credit card fraud, e-commerce fraud, and money laundering. For example, we can model with a graph the interactions between individuals with their credit cards, phone numbers, devices, IP addresses, etc., and uncover suspicious patterns that other kinds of databases might find difficult to detect, like multiple users coming from the same IP address.

7. Suitable cases - Real-time recommendations

With graph databases, we can create real-time recommendations. For example, we can store the buying history of the users and their browsing behavior to immediately recommend an item they may like, or we can even offer this recommendation to another user who is a friend. We can also recommend unwatched movies to a user by searching on the graphs for other movies watched by similar users.

8. Suitable cases - Networks

Another suitable case for graph databases is the storage of relationships between networks and their infrastructure elements, such as physical machines, virtual machines, applications, routers, switches, etc. In this domain, graphs can be used, for example, to alert in real-time about potential design flaws.

9. Unsuitable cases

By contrast, there are some situations where graph databases are not a good choice. Graph databases are not the best option when data is disconnected, or the relationships between the data are not important. Applications that only perform general searches, where we need to search the entire graph without a specific starting point, are not the best option for using graph databases, either. Although graph databases can handle those queries, they are not optimized for maximum performance. Finally, graph databases are not recommended when there are entity properties that contain extremely large values, like BLOBs, CLOBs, etc.

10. Let's practice!

Let's do some exercises to practice what we have learned!