cancel
Showing results for 
Search instead for 
Did you mean: 

Performance Issue in node creation

shiv4680
Node

Trying to run a query to create/merge node from nodejs.
It takes around 2 to 3 seconds to execute the below code snippet.

Code snippet :
const query = "CREATE (a:User {uid:$uid,name:$name}) RETURN a";
const params = {uid:"xyz001",name:"xyz"};
const result = await session.run(query,params);

If it takes 2-3 sec, it becomes unusable.
How to overcome it ? Do I need to fix anything in my code ?
Any efforts would be appreciated. Thanks.

2 REPLIES 2

busymo16
Ninja
Ninja

Hi @shiv4680,

depending on your query load, you might want to use apoc procedures, if you have a lot of nodes to create (millions - billions). call apoc.periodic.iterate can help you in this case, to create batches of nodes while taking care of you memory. Also, another thing is to tweak neo4j configurations and make sure that you have a good amount of memory for the pagecache. This is from the Neo4j side, from the Nodejs side I do not think that you can do much.

bennu_neo
Neo4j
Neo4j

Hi @shiv4680 ,

A simple creation should not take 2-3 seconds. Can you share the query.log for this statement where it shows a 2-3 sec time execution?

Oh, y’all wanted a twist, ey?