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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/12.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
Neo4j关系书写过程_Neo4j_Relationship - Fatal编程技术网

Neo4j关系书写过程

Neo4j关系书写过程,neo4j,relationship,Neo4j,Relationship,我正在使用Neo4j图形创建图形数据库。使用load csv命令创建关系。将100万个数据行关系加载到任何关系中需要2小时。有没有其他方法可以更快地创建关系?创建比合并更快。使用合并或匹配可能会导致“急切操作”。请通读这篇文章以供更多参考 作为解决方法,您可以尝试以下查询 USING PERIODIC COMMIT LOAD CSV WITH HEADERS FROM "file:///raw.csv" AS row MATCH (tweet_id:tweet_id {name: row.tw

我正在使用Neo4j图形创建图形数据库。使用load csv命令创建关系。将100万个数据行关系加载到任何关系中需要2小时。有没有其他方法可以更快地创建关系?

创建比合并更快。使用合并或匹配可能会导致“急切操作”。请通读这篇文章以供更多参考

作为解决方法,您可以尝试以下查询

USING PERIODIC COMMIT LOAD CSV WITH HEADERS FROM "file:///raw.csv" AS row 
MATCH (tweet_id:tweet_id {name: row.tweet_id}) with tweet_id
MATCH (indexed_date:indexed_date {name: row.indexed_date}) with indexed_date,tweet_id
CREATE (indexed_date)-[date_i_tweet:date_i_tweet]->(tweet_id);
您可以在查询中使用WITH,以避免将cartisian产品和整个“行”传递下去。尝试将索引添加到索引日期,然后尝试以下查询

USING PERIODIC COMMIT LOAD CSV WITH HEADERS FROM "file:///raw.csv" AS row 
MATCH (tweet_id:tweet_id {name: row.tweet_id}) with tweet_id
MATCH (indexed_date:indexed_date {name: row.indexed_date}) with indexed_date,tweet_id
CREATE (indexed_date)-[date_i_tweet:date_i_tweet]->(tweet_id);

希望这对您的查询有所帮助,您应该:

tweet_id上的唯一约束:在n:tweet_id资产上创建约束n.tweet_id是唯一的 唯一约束或索引的\u日期:在n:索引的\u日期资产n上创建约束。索引的\u日期是唯一的
干杯

您能分享您的密码加载csv查询吗?您是否创建了一些索引/约束?q=“使用定期提交加载CSV并从file:///raw.csv AS行匹配tweet\u id:tweet\u id{name:row.tweet\u id}匹配索引日期:索引日期{name:row.indexed\u date}合并索引日期-[date\u i\u tweet:date\u i\u tweet]->tweet\u id;'graph_3.cypher.executeeqi已经在tweet上创建了索引,谢谢大家。这很有帮助。谢谢。这很有帮助。只是一个问题。你在neo4j上进行过实时更新吗。随着数据大小的增加,更新过程会降低。有没有关于更快更新garph的建议?是的,更新速度很慢。尝试限制数据或一次只关注一组属性/节点。更新的速度也取决于您的模式。