我正在针对具有大约40,000个节点的数据库测试以下cypher语句的性能(导入csv / nodes很快)。我基本上试图将孩子与三维矩阵中的父母联系起来。
所以p是父母,c是孩子。行dim为1,col为dim 2,level为dim 3
match (p:_Cell),(c:_Cell) where p.col = c.col and p.level = c.level and p.row = 'AB' and c.row in ['ABB','ABC','ABD'] create (c)-[:ROW]->(p)
我认为IN导致语句变慢,所以改变它是一个非常慢的平等。服务器在700ms执行语句:
match (p:_Cell),(c:_Cell) where p.col = c.col and p.level = c.level and p.row = 'AB' and c.row = 'ABB' create (c)-[:ROW]->(p)
服务器通过localhost:7474
运行速度不到一秒钟。在嵌入式Java版本中,它运行超过2分钟。
我尝试过标准配置。我也尝试过设置
config.driverConfiguration() .setDriverClassName("org.neo4j.ogm.drivers.embedded.driver.EmbeddedDriver");
config.set("node_auto_indexing", true);
config.set("node_keys_indexable","row,col,level");
config.set("bms.memory.pagecache.size","10g");
return config;
日志 09:20:54.571 [main] INFO org.neo4j.ogm.drivers.embedded.request.EmbeddedRequest - 请求:匹配(p:_Cell),(c:_Cell)其中p.col = c.col和p.level = c.level和p.row =' AB'和c。在[' ABB',' ABC' ABD']中创建(c) - [:行] - >(p)与params {} 09:20:54.571 [main] DEBUG org.neo4j.ogm.drivers.embedded.driver.EmbeddedDriver - 没有当前的交易,开始新的交易 09:20:54.571 [main] DEBUG org.neo4j.ogm.drivers.embedded.driver.EmbeddedDriver - 本机事务:org.neo4j.kernel.TopLevelTransaction 09:22:13.155 [main] DEBUG org.neo4j.ogm.drivers.embedded.response.EmbeddedResponse - 响应已打开:org.neo4j.ogm.drivers.embedded.response.RestModelResponse 09:22:13.155 [main] DEBUG org.neo4j.ogm.drivers.embedded.response.EmbeddedResponse - 响应已关闭:org.neo4j.ogm.drivers.embedded.response.RestModelResponse 09:22:13.156 [main] DEBUG org.neo4j.ogm.drivers.embedded.transaction.EmbeddedTransaction - 提交本机事务:org.neo4j.kernel.TopLevelTransaction 09:22:13.238 [main] DEBUG org.neo4j.ogm.transaction.Transaction - 线程1:提交事务范围:0 09:22:13.238 [main] DEBUG org.neo4j.ogm.transaction.Transaction - 线程1:已提交 09:22:13.238 [main] DEBUG org.neo4j.ogm.transaction.Transaction - 线程1:关闭事务范围:0 09:22:13.238 [main] DEBUG org.neo4j.ogm.transaction.Transaction - 主题1:关闭交易
Neo4j版
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-ogm-core</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-ogm-embedded-driver</artifactId>
<version>2.0.2</version>
</dependency>