O'Reilly logo

Learning Neo4j 3.x - Second Edition by Rik Van Bruggen, Jérôme Baton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Timeboxed execution of Cypher statements

If we want to run a Cypher query that must not take more than a given amount of time, there is a way:

CALL apoc.cypher.runTimeboxed(CypherStatement, params, timeoutInMs)

Neat, but what is it good for? You may use it to restrain how much CPU time you give to some users of your database, not with standing the roles that are given in your application:

CALL apoc.cypher.runTimeboxed('MATCH (n) return n',NULL, 2)

Provided you still have numerous nodes in your database, it's unlikely that a complete result can be reached in under two milliseconds. So the result will be an error, as shown in the following image:

Out of time, man -> terminated

Be aware that the returned result uses the database cache that ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required