我使用OrientDB存储有关视频租借的信息。我将成员和电影表示为节点。每当一个成员借一部电影时,我就会在它们之间添加一条边。数据集具有多次用户借用电影。此外,我需要存放哪个月/季(仍然决定哪个适合我们的需要,但除此之外)是租来的电影。我打算在边缘存储上面提到的细节。但是我遇到了这个: http://orientdb.com/docs/2.1/Performance-Tuning-Graph.html
建议避免在边缘存储属性。我想知道我是否应该改变方法?如果是,那么替代方案是什么?
提前致谢。
答案 0 :(得分:1)
我认为在您的情况下,您可能会选择直接在边缘创建财产。存储与租赁相关的数据的替代方法是在成员和电影之间创建第三个节点(例如RentalData)并利用PK和FK字段,但它与关系数据库类似,并且不是必需的。
我复制了一个小数据库:
create class Member extends V;
create property Member.id integer;
create property Member.name string;
create property Member.surname string;
create index Member.id unique;
create class Movie extends V;
create property Movie.id integer;
create property Movie.title string;
create property Movie.minutes integer;
create index Movie.id unique;
create class borrows extends E;
create property borrows.rentaldate Datetime;
create vertex Member set id = 1, name = "Paul", surname = "Green";
create vertex Member set id = 2, name = "John", surname = "Smith";
create vertex Member set id = 3, name = "Frank", surname = "Redding";
create vertex Movie set id = 1, title = "Interstellar", minutes = 170;
create vertex Movie set id = 2, title = "The Gladiator", minutes = 176;
create edge borrows from (select from Member where id = 1) to (select from Movie where id = 1) set rentaldate = sysdate();
create edge borrows from (select from Member where id = 1) to (select from Movie where id = 2) set rentaldate = sysdate();
create edge borrows from (select from Member where id = 2) to (select from Movie where id = 2) set rentaldate = sysdate();
create edge borrows from (select from Member where id = 3) to (select from Movie where id = 1) set rentaldate = sysdate();
create edge borrows from (select from Member where id = 3) to (select from Movie where id = 2) set rentaldate = sysdate();
我存储了" rentaldata"直接在边缘的财产"借用"将会员与借来的电影联系起来,我想你可以像我这样做。
答案 1 :(得分:0)