Manage queries
List all running queries
The procedure for listing queries, dbms.listQueries()
, is replaced by the command for listing transactions, SHOW TRANSACTIONS
.
This command returns information about the currently executing query in the transaction.
For more information on the command, see the Cypher manual → SHOW TRANSACTIONS
command.
List all active locks for a query
An administrator is able to view all active locks held by the transaction executing the query with the queryId
.
Syntax:
CALL dbms.listActiveLocks(queryId)
Returns:
Name | Type | Description |
---|---|---|
|
String |
Lock mode corresponding to the transaction. |
|
String |
Resource type of the locked resource |
|
Integer |
Resource id of the locked resource . |
The following example demonstrates how to show the active locks held by the transaction executing a given query.
Firstly, to get the IDs of the currently executing queries, yield the currentQueryId
from the SHOW TRANSACTIONS
command:
SHOW TRANSACTIONS YIELD currentQueryId, currentQuery
Then, call dbms.listActiveLocks
passing the currentQueryId
of interest (query-614
in this example):
CALL dbms.listActiveLocks( "query-614" )
╒════════╤══════════════╤════════════╕ │"mode" │"resourceType"│"resourceId"│ ╞════════╪══════════════╪════════════╡ │"SHARED"│"SCHEMA" │0 │ └────────┴──────────────┴────────────┘ 1 row
Terminate queries
Queries are terminated by terminating the transaction on which they are running. This is done using the TERMINATE TRANSACTIONS transactionIds
command.
The transactionIds
can be found using the SHOW TRANSACTIONS
command.
The TERMINATE TRANSACTION
privilege determines what transactions can be terminated.
However, the current user can always terminate all of their own transactions.
Syntax:
TERMINATE TRANSACTIONS transactionIds
Argument:
Name | Type | Description |
---|---|---|
|
Comma-separated strings |
The IDs of all the transactions to be terminated. |
|
Single string parameter |
The ID of the transaction to be terminated. |
|
List parameter |
The IDs of all the transactions to be terminated. |
For more information on the command, see the Cypher manual → TERMINATE TRANSACTIONS
command.
Was this page helpful?