Reputation: 2842
We want to create a very slow query to test it in our application. Is there any way to make a Neo4j query last for a specific amount of seconds?
Upvotes: 4
Views: 738
Reputation: 16375
I believe you can use the APOC procedure apoc.util.sleep.
According the docs:
apoc.util.sleep({duration})
: sleeps for millis, transaction termination is honored
For example:
CALL apoc.util.sleep(1000) // wait for 1 second
MATCH (node) // match 'node'...
RETURN node // ... return 'node'
Please remember to install APOC procedures according the version of Neo4j you are using. Take a look in the Version Compatibility Matrix.
Upvotes: 9
Reputation: 8556
You can enable the execution guard by setting a value for dbms.transaction.timeout in neo4j.conf
. This will set the maximum time for a transaction to run.
By default the value is 0s
which disables the execution guard
Upvotes: 0