Each iteration of a python loop sends a cypher-query to Neo4j that returns values. This takes a considerable amount of time and is a bottleneck , as the number of loop items is 50 or more.
Would one call to a custom stored procedure be faster than repeated client requests to Neo4j?
The stored procedure would be passed cypher parameters for all 50 items, and need to return results for all 50.
Well, if you can refactor your code to make one call to a stored procedure, it means you can also refactor to make one Cypher query and handle the result application side.
Maybe a stored procedure will be faster since you can leverage the JVM multithreading.
However, there are some drawbacks to using stored procedures:
I have rarely seen the usage of stored procedures for improving performance (it happens but it has some niche use cases).
As you stated, the bottleneck is your loop querying the db, I would try to fix that first.
Secondly, performance in Neo4j is generally handled by three major factors:
In 99.99% of the problems you will have during your life with Neo4j will be solved by those 3 points above.
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.