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:
Be aware that the returned result uses the database cache that ...