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
Graph 如何在Neo4j中提高查询效率?_Graph_Neo4j_Cypher - Fatal编程技术网

Graph 如何在Neo4j中提高查询效率?

Graph 如何在Neo4j中提高查询效率?,graph,neo4j,cypher,Graph,Neo4j,Cypher,我需要使用函数apoc.export.cyphe.data()导出数据库的一部分。 下面是我用来调用函数的代码: MATCH path = (p1:Author)-[r:CO_AUTHORSHIP]-(p2:Author) WITH collect(p1)+collect(p2) as export_nodes,collect(r) as export_rels CALL apoc.export.cypher.data(export_nodes,export_rels,'/tmp/expor

我需要使用函数apoc.export.cyphe.data()导出数据库的一部分。 下面是我用来调用函数的代码:

MATCH path = (p1:Author)-[r:CO_AUTHORSHIP]-(p2:Author) WITH collect(p1)+collect(p2) as 
export_nodes,collect(r) as export_rels CALL 
apoc.export.cypher.data(export_nodes,export_rels,'/tmp/export.cypher',{format:'cypher- 
shell',cypherFormat: 'updateAll'}) YIELD file, source, format, nodes, relationships, 
properties,timeRETURN nodes, relationships, time
问题是查询 匹配路径=(p1:作者)-(r:合作作者)-(p2:作者) 花了一个多小时

我有一个数据库,有467437个合作作者关系。数据库的每个节点代表一个作者。对于每个关系边缘,我存储关于两位作者撰写的文章(文章数量、类型、地点、标题和年份)的数据


有没有办法提高查询的效率?

您的查询将每个
作者
放入
导出节点
多次,每个
合作作者关系
放入
导出关系
多次。这应该更快,使用更少的内存:

MATCH path = (a:Author)-[r:CO_AUTHORSHIP]-()
WITH COLLECT(DISTINCT a) AS export_nodes, COLLECT(DISTINCT r) AS export_rels
CALL apoc.export.cypher.data(
  export_nodes, export_rels, '/tmp/export.cypher', 
  {format:'cypher-shell', cypherFormat: 'updateAll'}) YIELD nodes, relationships, time
RETURN nodes, relationships, time