How to kill long running query

How can we kill long running query without restart.I tried using command call dbms.killQuery('query-16172'),but its not working.

Regards,
Tanmoy

Query management (https://neo4j.com/docs/operations-manual/current/monitoring/query-management/) is a feature in Enterprise Edition only. Just in case you're on Community Edition.

Similar problem here. I'm in the Enterprise version and often get long running queries that don't seem to be able to killed.

That may depend on what the consequences are of that query being executed.

For example, if it starts resulting in high garbage collection operations, those pause processing, so a bad query may prevent you from being able to communicate with the server.

We do have improvements coming in 4.0 for setting limits on the amount of memory a query is allowed to use which will auto-terminate it if it crosses that threshold. That may help out for scenarios like these.

if you're using Neo4j Browser then open Neo4j in another browser window and run this query there "CALL dbms.listQueries()" which will give you list of running queries with their respective IDs and you can kill each of them using this "call dbms.killQuery('query-id')" from here.

2 Likes

great, this is what i was looking for to trap long running query

@andrew.bowman limiting memory ... that is one way to kill query. But this will impact if i am caching graph for further processing.
Can we able to terminate/manage/see long running queries (based on execution time not by memory) in community version.

Not currently, at this point in time that's still enterprise edition only.

But it is possible that may change in the future, especially with the new 4.0 enterprise features, so there's much more out there now to differentiate the editions. I'd love to see query/transaction listing and killing available in community edition, but if and when is up in the air.