简体   繁体   English

图三元组和EAV之间的区别

[英]Difference between Graph Triples and EAV

Recently I've started to play with cayley and ArangoDB for their graph datastores. 最近,我开始玩凯莱ArangoDB他们的图形数据存储。

While reading and watching videos about graph databases a question popped up into my mind: what makes a graph database so different (and "awesome") from a typical (and horrible) EAV store in normal SQL? 在阅读和观看有关图形数据库的视频时,我想到了一个问题:是什么使图形数据库与普通SQL中典型的(且可怕的)EAV存储如此不同(又“太棒了”)?

In this presentation , the following citation shows up: 在此演示文稿中 ,出现以下引用:

a graph database is any storage system that provides index-free adjacency 图形数据库是任何提供无索引邻接的存储系统

But what does index-free adjacency mean exactly? 但是,无索引邻接到底是什么意思? And how does that affect performance or design? 以及这如何影响性能或设计?

With the following schema, all the queries listed in the slides are possible and super simple: 使用以下架构,幻灯片中列出的所有查询都是可能的,而且非常简单:

CREATE TABLE "graph" (
    "subject" TEXT NOT NULL,
    "predicate" TEXT NOT NULL,
    "object" TEXT NOT NULL
);

-- Give me all the vertex that go from "A":
SELECT "object" FROM "graph" WHERE "subject" = 'A';

-- Give me all the pairs connected by "C":
SELECT "subject", "object" FROM "graph" WHERE "predicate" = 'C';

-- Give me all the vertex that go to "B":
SELECT "subject" FROM "graph" WHERE "object" = 'B';

-- Give me all the vertex that go to "B" through "C":
SELECT "subject" FROM "graph" WHERE "object" = 'B' AND "predicate" = 'C';

well, to be honest index-free adjacency i basically a marketing buzzword. 好吧,说实话,无索引邻接基本上是一个营销流行语。 I agree, your examples are simple and possible, but using a graph database enables you to perform queries that will be not so easy to handle (and most of all very bad performing) on mysql. 我同意,您的示例很简单并且可能,但是使用图形数据库可以使您执行在mysql上不那么容易处理的查询(而且大多数情况下执行起来非常糟糕)。 Fe if you want to know the shortest path between two vertices in a graph you can't do it using mysql. 如果您想知道图中两个顶点之间的最短路径,则不能使用mysql来完成。

In ArangoDB it is one simple call: 在ArangoDB中,这是一个简单的调用:

GRAPH_SHORTEST_PATH("yourGraph", "StartVertex", "EndVertex") GRAPH_SHORTEST_PATH(“ yourGraph”,“ StartVertex”,“ EndVertex”)

If you are interested in the various functions ArangoDBs graph module provides i can recommend to read the graph manual and the examples, i am pretty sure you will find a lot of use cases where you would struggle to achieve the same in mysql. 如果您对ArangoDBs图形模块提供的各种功能感兴趣,我建议您阅读图形手册和示例,我敢肯定,您会发现很多用例,您将很难在mysql中实现相同的功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM