最近我开始使用cayley和ArangoDB来开发他们的图形数据存储。
在阅读和观看有关图形数据库的视频时,一个问题突然出现在我的脑海中:是什么让图形数据库与普通 SQL 中的典型(和可怕的)EAV 存储如此不同(并且“很棒”)?
在此演示文稿中,出现了以下引文:
图形数据库是任何提供无索引邻接的存储系统
但是无索引邻接究竟是什么意思呢?这对性能或设计有何影响?
使用以下模式,幻灯片中列出的所有查询都是可能的并且超级简单:
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';