Neo4j CSV导入速度太慢 [英] Neo4j CSV import being too slow

查看:2972
本文介绍了Neo4j CSV导入速度太慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这个问题已被问过几次,但没有一个答案解决了我的问题。我使用以下查询导入数据:

I know this question has been asked several times but none of the answers solved my problem. I am using the following query to import the data:

USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM
'file:///C:/Users/Zo5/Documents/Neo4j/check/import/result1.csv' AS line1
MERGE (p:Person {forename:line1.forename, surname:line1.surname,     nationality:line1.nationality, occupation:line1.occupation, title:line1.title})

但是过程太慢了。 CSV文件大约700MB。导入0.01 GB大约需要15分钟。我在新数据库上尝试过相同的查询,但这个过程要快得多。有谁知道什么可能导致这个问题?请注意,我在 forename 上有索引。

but the process is too slow. The CSV file is about 700MB. It takes about 15 minutes for 0.01 GB to be imported. I have tried the same query on a new database and the process is a lot faster. Does anyone know what might cause this problem? Note that I have index on forename.

推荐答案

有哪些属性唯一识别一个人的?对MERGE使用THOSE属性,然后对其余属性使用ON CREATE SET。

What are the properties that uniquely identify a person? Use THOSE properties for the MERGE, then use ON CREATE SET for the remaining properties.

因为它现在是您的查询,对于每个MERGE,它会将具有所有给定属性的Person与现有的一组:人员进行比较以查看它们是否已存在。通过缩小MERGE中使用的属性,你可以比较少,虽然比较仍然会发生,你的插入会慢慢变慢。

As it is now your query, for each MERGE, it will compare the :Person with all your given properties to the existing set of :Persons to see if they already exist. By narrowing down the properties used in your MERGE, you will have less to compare, though the comparisons will still happen and your inserts will get steadily slower.

如果你知道:您添加的人员尚不存在,请使用CREATE而不是MERGE。

If you know that the :Persons you are adding do not already exist, then use CREATE instead of MERGE.

这篇关于Neo4j CSV导入速度太慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆