New feature request

49 views
Skip to first unread message

unreal...@googlemail.com

unread,
Mar 22, 2017, 6:09:50 AM3/22/17
to Neo4j

It would be good to be able to specify a maximum run time of a query - I know that you can set this as a global parameter but on a per query basis would be very useful in some circumstances. 

i.e.

match ().........  return a timeout=10;

Wayne

Benoît Simard

unread,
Mar 22, 2017, 6:35:27 AM3/22/17
to ne...@googlegroups.com
Hi,

There is a procedure to do that in APOC, called `apoc.cypher.runTimeboxed`
Check the documentation
https://neo4j-contrib.github.io/neo4j-apoc-procedures/#_cypher_execution

Cheers
> --
> You received this message because you are subscribed to the Google Groups
> "Neo4j" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to neo4j+un...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

unreal...@googlemail.com

unread,
Mar 22, 2017, 8:43:48 AM3/22/17
to Neo4j

Thanks for the prompt response.

Further question:

This works from the Web GUI:

call apoc.cypher.runTimeboxed('match (n:Entity)-[*4]-() where n.name="hello" return n.name;',null, 10000)

Why doesn't this work:
echo "call apoc.cypher.runTimeboxed('match (n:Entity)-[*4]-() where n.name="hello" return n.name;',null, 10000)" | ~fred/neo4j/bin/cypher-shell

Bye!

unreal...@googlemail.com

unread,
Mar 22, 2017, 8:55:08 AM3/22/17
to Neo4j
Found the answer:

$ echo "call apoc.cypher.runTimeboxed('match (n:Entity)-[*4]-() where n.name=\"hello\" return n.name;',null, 10000);" | ~fred/neo4j/bin/cypher-shell
The transaction has been terminated. Retry your operation in a new transaction, and you should see a successful result. Explicitly terminated by the user.

Bye!

unreal...@googlemail.com

unread,
Mar 24, 2017, 8:18:23 AM3/24/17
to Neo4j
Sorry, another question:

In my solution above I use null for {params}

I notice that this give me the following message in the neo4j.log:

2017-03-24 12:15:28.955+0000 WARN  marking KernelTransaction[statementLocks == null] for termination

Should I be using something other than null ?

Michael Hunger

unread,
Mar 24, 2017, 8:49:10 AM3/24/17
to ne...@googlegroups.com
It's unrelated 

Von meinem iPhone gesendet

unreal...@googlemail.com

unread,
Mar 26, 2017, 10:29:42 AM3/26/17
to Neo4j
But I have only seen the message since using the apoc.cypher.runTimeboxed call.

Michael Hunger

unread,
Mar 27, 2017, 1:50:29 PM3/27/17
to ne...@googlegroups.com
Yes b/c runTimboxed ends the query. But the two nulls are not relatd

To unsubscribe from this group and stop receiving emails from it, send an email to neo4j+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages