Neo4j - 表现不佳

时间:2016-01-28 13:25:25

标签: neo4j py2neo

我每天都会收到一份包含所有客户的完整csv文件。我需要插入/更新neo4j数据库。所以我使用这个查询:

我已在hash字段创建索引。

MERGE (XFEWYX:CUSTOMER_BSELLER {hash:'xyz@hotmail.com'} ) ON CREATE SET XFEWYX.hash = 'xyz@hotmail.com',XFEWYX.name = 'XYZ ',XFEWYX.birthdate = '1975-05-20T00:00:00',XFEWYX.id = '1770852',XFEWYX.nick = 'CLARISSA',XFEWYX.documentNumber = 'XYZ',XFEWYX.email = 'clarissajuridica@hotmail.com'  with XFEWYX
MERGE (WHHEKX:EMAIL {hash:'clarissajuridica@hotmail.com'} ) ON CREATE SET WHHEKX.hash = 'clarissajuridica@hotmail.com',WHHEKX.email = 'clarissajuridica@hotmail.com'  with XFEWYX,WHHEKX
MERGE (JJKONT:DOCUMENT {hash:'06845078700'} ) ON CREATE SET JJKONT.document = 'XYZ',JJKONT.hash = '06845078700'  with XFEWYX,WHHEKX,JJKONT
MERGE (MERUCB:PHONE {hash:'NoneNone'} ) ON CREATE SET MERUCB.areaCode = 'None',MERUCB.hash = 'NoneNone',MERUCB.number = 'None'  with XFEWYX,WHHEKX,JJKONT,MERUCB
MERGE (BOORBT:PHONE {hash:'XYZ'} ) ON CREATE SET BOORBT.areaCode = '21',BOORBT.hash = 'XYZ',BOORBT.number = 'XYZ'  with XFEWYX,WHHEKX,JJKONT,MERUCB,BOORBT
MERGE (XBLZNF:PHONE {hash:'XYZ'} ) ON CREATE SET XBLZNF.areaCode = '21',XBLZNF.hash = 'XYZ',XBLZNF.number = 'XYZ'  with XFEWYX,WHHEKX,JJKONT,MERUCB,BOORBT,XBLZNF
MERGE (XFEWYX)-[:REGISTERED_WITH {optin:'false'}]->(WHHEKX)
MERGE (XFEWYX)-[:DOCUMENT]->(JJKONT)
MERGE (XFEWYX)-[:COMMERCIAL_PHONE]->(MERUCB)
MERGE (XFEWYX)-[:PHONE]->(XBLZNF)
MERGE (XFEWYX)-[:CELL_PHONE]->(BOORBT)

有没有人有另一种方法来执行此查询?

1 个答案:

答案 0 :(得分:1)

我会尝试使用PROFILE命令。您可以在LIMIT(我假设您使用LOAD CSV)上放置LOAD CSV进行测试。

我也会查看这篇文章:

http://www.markhneedham.com/blog/2014/10/23/neo4j-cypher-avoiding-the-eager/

其中一些已经在Neo4j的最新版本中得到修复,但是你有很多MERGE,所以你可能会分开一些并多次处理你的CSV文件。