【发布时间】:2016-05-16 11:55:21
【问题描述】:
Orientdb : 2.1.3
Pyorient : 1.4.7
我需要通过 pyorient 将一个包含十万个顶点和 50 万条边的图导入 Orientdb。
db.command 一个一个
首先,我只是使用 db.command("create vertex V set a=1") 将所有顶点和边一个一个插入。
但这需要我大约两个小时。
所以我想找到一种方法来优化这个过程。
大量插入?
然后发现Orientdb支持Massive Insert,可惜pyorient的作者在一个issuemassive insertion: no transacations? 提到了
在 bynary 协议中(当然在 pyorient 中)没有大量的插入意图。
SQL 批处理
Pyorient 支持sql batch。也许这是一个机会!
我只是将所有插入命令放在一起,然后通过 db.batch() 运行。
我以一个包含 5000 个顶点和 20000 个边的图为例
-
sql批处理
vertexs : 25.1708816278 s edges : 254.248636227 s -
原创
constrct vertexs : 19.5094766904 s construct edges : 147.627924276 s
..似乎 sql 批处理需要更多时间。
所以我想知道有没有办法。
谢谢。
【问题讨论】:
标签: orientdb graph-databases pyorient