What is a graph database

This document mainly introduce what is a graph database, the advantages of graph database compared with relational database, and the comparison between graph database and relational database

1. Introduction

Graph database is a database based on graph model. The main function of graph database is to manage graph data, so it needs to support efficient vertex/edge query and update; To facilitate user use, it is usually necessary to add transaction support to ensure the normal operation of concurrent operations.

2. Advantages of graph databases over relational databases

The function of graph database is an extension of traditional relational database. Compared with relational database, the graph structure supported by graph data is more flexible. Graph database is different from other databases in terms of data addition, deletion, query and modification based on graph. On the operation abstraction of graph data, a vertex-based perspective is adopted, for example, a vertex accesses its neighboring vertices through all its outgoing edges. This kind of operation is also the core of the design of graph database system.

The uniqueness of graph database can be reflected in the following three aspects:

2.1 Performance

Handling the relationship between data, it is inevitable to use table JOIN operation in relational database, which has a great impact on performance. Graph database is a direct access, similar to pointer access, which is more efficient operation of associated data, compared with relational database performance improvement of 2 to 4 orders of magnitude.

2.2 Compatibility

In reality, the process of a project is often evolutionary. The content and even the format of the data are constantly changing. In a relational database, this means that a change in the table structure, or the creation of multiple new tables, significantly changes the source data. In the graph database, you simply add new vertices, edges, and attributes, and set them to the corresponding types. In essence, a table represents a type of data, and a vertex represents a specific data, meaning that relational databases pay more attention to the type of data, while graph databases pay more attention to the individuals of data and identify their association relationships.

2.3 Intuitive

Using graphs (or nets) to express real-world relationships is more straightforward and natural, especially in the Internet of Things era. If relational data used, a high degree of abstract thinking required to build a table of characters first, then a table of relations, and finally a map of data. When analyzing and querying the graph data, you can also intuitively find the desired data interactively through the point-edge connection topology, without any professional knowledge.

3. Comparison between graph database and relational database

classification

model

advantage

disadvantage

example

Relational database

Table structure

Data is highly structured, consistent, and software maturity is high

The multi-hop association query is inefficient or not supported

MySQL、Oracle

Graph database

graph structure

Modeling and manipulating associations is very efficient

Highly structured data processing is not as powerful as relational databases

Neo4j、TuGraph

In a word, in the face of massive data storage and processing problems, the traditional relational database has been unable to meet most of the daily data storage needs. Graph database technology can store relational information as entities and expand data model flexibly. Because it provides the most direct expression of related data, and the graph model is naturally tolerant to heterogeneous data. In the future, graph database technology will become one of the most popular technologies, which will provide powerful support for enterprises to store and analyze large-scale graph data.