NebulaGraph database case study
4 min read
Problems with relational databases
Relational databases such as SQL databases use tables for storing data and forming relationships between the data. While these types of databases are relatively easy to write data into, it isn't very performant when it comes to retrieving data.
For specific use cases, such as a banking system, where data needs to be constantly written, and retrieving the data is not as important, SQL databases are a great solution. SQL databases work using a pre-defined data model, so if you want to add a new type of relation, you would need to create a new table, or change the schema accordingly.
To take an example, let's consider a social networking website. You would have to store multiple fields and relations such as a user's name, date of birth, contacts list, their relation with a user on their contacts list, etc. If the user decides to edit their profile and add some more information such as a bio, the database schema would need to be updated accordingly.
Let's say the relation stored in the contact list is of 'friend'. Now if the user decides they don't want to be friends anymore, there will be a new relation created of 'not-friends'. For this, a new table would need to be created.
NebulaGraph
NebulaGraph is a graph database that provides a solution to the above example. In a graph database, instead of storing data and relationships in the form of tables, it is stored in the form of nodes and edges.
Taking the social networking example from earlier, a node would contain the information of a single user, and the relationship would be defined using the edges. In the case of a graph database, it becomes much easier to change the data model as the data is stored in a node, and the relation is created between the nodes and not the actual data itself.
Graph databases are also optimized for data retrieval. This means that if you want to extract data for analysis or any other purpose. Graph databases are great for retrieving data and their relationships and it becomes easier to trace the relationship compared to tables.
Benefits of using graph databases
Graph databases have a number of advantages over traditional relational databases for several reasons. Some of the reasons are as follows:-
- Performance: For intensive data relationship handling, graph databases improve performance by several orders of magnitude. With traditional databases, relationship queries will come to a grinding halt as the number and depth of relationships increase. In contrast, graph database performance stays constant even as your data grows year over year.
- Flexibility: With graph databases, IT and data architect teams move at the speed of business because the structure and schema of a graph model flex as applications and industries change. Rather than exhaustively modeling a domain ahead of time, data teams can add to the existing graph structure without endangering current functionality.
- Agility: Developing with graph databases aligns perfectly with today’s agile, test-driven development practices, allowing your graph database to evolve in step with the rest of the application and any changing business requirements. Modern graph databases are equipped for frictionless development and graceful systems maintenance.
Use cases
NebulaGraph can be used to support various graph-based scenarios. To spare the time spent on pushing the kinds of data mentioned in this section into relational databases and on bothering with join queries, you can use NebulaGraph.
Fraud detection Financial institutions have to traverse countless transactions to piece together potential crimes and understand how combinations of transactions and devices might be related to a single fraud scheme. Imagine having to do this with relational databases. You would have to compare individual relations and find the correct table, which then again points to a different table. This kind of scenario can be modeled in graphs, and with the help of NebulaGraph, fraud rings and other sophisticated scams can be easily detected.
Real-time recommendation Suppose you have created a blogging platform, and you want to recommend articles for your users to read based on their reading history. NebulaGraph offers the ability to instantly process the real-time information produced by a visitor and make accurate recommendations on articles, videos, products, and services.
Intelligent question-answer system Natural languages can be transformed into knowledge graphs and stored in NebulaGraph. A question organized in a natural language can be resolved by a semantic parser in an intelligent question-answer system and re-organized. Then, possible answers to the question can be retrieved from the knowledge graph and provided to the one who asked the question.
Social networking Information on people and their relationships is typical graph data. NebulaGraph can easily handle the social networking information of billions of people and trillions of relationships and provide lightning-fast queries for friend recommendations and job promotions in the case of massive concurrency.
Conclusion
Relational databases and Graph databases both have their specific usage scenarios. If you want to just store data, and not retrieve it often relational databases will do the job.
However, if you want to retrieve the data often, such as in a recommendation engine, graph databases are the way to go, as it is easier and more efficient.