简体   繁体   中英

Neo4j - poor performance

I receive daily a full csv file with all customers. I need to insert/update the neo4j database. So I am using this query:

I already create indexes on hash field.

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)

Does anyone have another approach how to execute this query?

I would try using the PROFILE command. You might put a LIMIT on your LOAD CSV (I assume you're using LOAD CSV ) for the testing.

I would also check out this article:

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

Some of that has been fixed in recent versions of Neo4j, but you have an awful lot of MERGE s there, so you probably could stand to split some of that up and process your CSV file more than once.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM