insert node in neo4j is very slow

2k views Asked by At

I'm trying to insert a single node in my graph without any relationships and it takes 1/10 sec, so when I need to insert 10 nodes that should take 1 sec which is a lot comparing with some results I found in my google search for some people who claim to insert 30k nodes in 1 sec.
I use the neo4jclient with cypher queries to do that :

            gclient.Cypher
   .Create("(p:Post {newPost})")
   .WithParams((new
   {
       newPost = post
   }))
   .ExecuteWithoutResults();

Is there something I miss ? thanks in advance



Edit : I'm using neo4jclient with .net .

2

There are 2 answers

6
FrobberOfBits On

I'm guessing you're using a REST API client, i.e. connecting to a web endpoint. That involves of course going through multiple protocol layers (JSON, HTTP, etc), and tends to be slower.

People who are doing 30k nodes in 1 second aren't going through the REST API, they may be using batch insertion, the import tool, or possibly LOAD CSV.

0
Anton Maximov On

You should also check your indexes and constraints. Unique constraints can slow down inserts and updates dramatically.