cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

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

10 REPLIES 10

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.

@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.

Hi Andrew,

Was this memory limit with auto-terminate, implemented in 4.0 as you mentioned? I am looking for something like that for my apoc-based queries looking for multiple hops between two nodes. They tend to blow up in size (especially in breadth-first-search) and sink the server so that I can't even connect on a different browser window to kill the query.

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.

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

By 2022/3, it is suggested to use show transactions and then TERMINATE TRANSACTION[S] transaction_id[, ...]

Doc: https://neo4j.com/docs/cypher-manual/4.4/clauses/transaction-clauses/#query-terminate-transactions