36

How can I kill a currently long-running query in Neo4j (without restarting the server)?

I know we can globally set a timeout for queries, but sometimes I want to execute heavy queries/creates/updates on the server that could take a while...

Thanks.

l4mpi
  • 5,103
  • 3
  • 34
  • 54
Gil Stal
  • 3,354
  • 4
  • 29
  • 32
  • That is planned in 2.x, we are right now structuring the code for having the concept of a request through all layers, among other in order to be able to kill it. – Peter Neubauer Apr 17 '13 at 13:34
  • @PeterNeubauer :When will the first stable version of 2.0 should come out? and when specifically this feature will come out ? – Gil Stal Apr 17 '13 at 13:37
  • Maybe, replace long-running query by many short-running? Can you write about your task here or to my e-mail? – Evgenii Apr 23 '13 at 09:27
  • @Eugeny: I know I can do that, but my question is about already running queries. I'm not the only developer so I can't control every cypher query that is being executed. besides, sometimes people make mistakes and I want to fix them without restarting the neo4j server. – Gil Stal Apr 23 '13 at 10:39
  • You can to create plugin and execute each long-running query in new thread (and kill it when you want). – Evgenii Apr 23 '13 at 11:38
  • @Eugeny maybe you should write that up as the answer – Spaceghost Jun 03 '13 at 02:41
  • 4
    @PeterNeubauer Now that 2.0 has been around for a bit, is there a way to accomplish this without writing a plugin? – Tasos Bitsios Aug 22 '14 at 18:10
  • 1
    Have a look at this forum post [https://groups.google.com/forum/m/#!topic/neo4j/5ec8FThLTeo]( https://groups.google.com/forum/m/#!topic/neo4j/5ec8FThLTeo) – TechnoCrat Mar 06 '15 at 15:48

5 Answers5

11

Available in version >3.1 Enterprise with

CALL dbms.listQueries()
CALL dbms.killQuery(queryId) 

Admins may "kill'em all"

There is also

 :queries
Jerome_B
  • 1,079
  • 8
  • 15
1

Currently there is no way to abort queries in Neo4j. At least I haven't found anything when I needed and I searched the docs quite a lot of times.

1

The 2.2 release has some functionality around this area, but still no monitoring tool that you could see, for example, the queries ran by other clients, you can only kill your own long running queries, executed through the web ui or the shell.

Neo4J 2.2 Release Notes

Mike D
  • 220
  • 1
  • 4
  • 12
0

I think there is no way to abort queries in Neo4j.

There is a way to kill long running queries automatically with the Guard stuff (you can pick either max number of operations or a timeout). There were some instructions sent out (couldn't find it immediately and I need to run).

Anuj Gupta
  • 159
  • 1
  • 4
0

I found that in the shell pressing CTRL-C terminates the query (running V3.0.3)

Albert S
  • 2,552
  • 1
  • 22
  • 28