Theo
Theo

Reputation: 2842

Make neo4j query last long for testing purposes?

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

Answers (2)

Bruno Peres
Bruno Peres

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

William Lyon
William Lyon

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

Related Questions