Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/neo4j/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
java中Neo4j Cypher查询执行和获取结果非常慢_Neo4j - Fatal编程技术网

java中Neo4j Cypher查询执行和获取结果非常慢

java中Neo4j Cypher查询执行和获取结果非常慢,neo4j,Neo4j,我使用java中的Neo4j作为独立应用程序。 我在从ExecutionResult获取结果时遇到了问题,速度非常慢 long start1= System.currentTimeMillis(); er= (ExecutionResult)graphDb.execute(query); long end1= System.currentTimeMillis(); System.out.println("Execution

我使用java中的Neo4j作为独立应用程序。 我在从ExecutionResult获取结果时遇到了问题,速度非常慢

        long start1= System.currentTimeMillis();
        er= (ExecutionResult)graphDb.execute(query);    
        long end1= System.currentTimeMillis();

        System.out.println("ExecutionResult time:"+ (end1-start1));

        long start= System.currentTimeMillis();

        Iterator<Node> personResultIterator = er.columnAs("columnname");
        while(personResultIterator.hasNext()){
            System.out.println(personResultIterator.next());
               }

        long end= System.currentTimeMillis();
        System.out.println("Iterator time : "+ (end-start));
long start1=System.currentTimeMillis();
er=(ExecutionResult)graphDb.execute(查询);
long-end1=System.currentTimeMillis();
System.out.println(“执行结果时间:+(end1-start1));
长启动=System.currentTimeMillis();
迭代器personResultIterator=er.columnAs(“columnname”);
while(personResultIterator.hasNext()){
System.out.println(personResultIterator.next());
}
long end=System.currentTimeMillis();
System.out.println(“迭代器时间:+(结束-开始));
执行结果时间:21

迭代器时间:2493

迭代器占用的时间太长。我还尝试使用DumpString、ResultasString和JsonHelper从执行结果中获取值,它们也会花费相同的时间。 执行查询不需要时间,但从执行结果中获取值的速度非常慢。 请帮助解决这个问题


关于

您可能需要从循环中删除
System.out.println()
,只需执行
personResultIterator.next()
并检查执行时间。有时候这会让你的时间慢很多。谢谢你的回复,问题是密码查询。我们使用正则表达式运算符忽略大小写敏感度,这需要时间。我们将节点更改为小写,并以小写搜索字符串。您可能希望从循环中删除
System.out.println()
,只需执行
personResultIterator.next()
并检查执行时间。有时候这会让你的时间慢很多。谢谢你的回复,问题是密码查询。我们使用正则表达式运算符忽略大小写敏感度,这需要时间。我们将节点改为小写,搜索字符串改为小写。