Transaction commands
This section explains the
SHOW TRANSACTIONS
andTERMINATION TRANSACTIONS
commands.
SHOW TRANSACTIONS
The SHOW TRANSACTIONS
command is used to display running transactions within the instance.
This also includes fabric transactions.
For remote database aliases, transactions can be tracked by running SHOW TRANSACTIONS
when connected to the remote database alias.
The command |
This command will produce a table with the following columns:
Column | Description | Type |
---|---|---|
|
The name of the database the transaction is executing against. Default Output |
|
|
The transaction ID. Default Output |
|
|
The ID of the query currently executing in this transaction, or an empty string if no query is currently executing. Default Output |
|
|
The ID of the database connection attached to the transaction or an empty string for embedded connections. Default Output |
|
|
The client address of the connection issuing the transaction or an empty string if unavailable. Default Output |
|
|
The username of the user executing the transaction. Default Output |
|
|
The query text of the query currently executing in this transaction, or an empty string if no query is currently executing. Default Output |
|
|
The time at which the transaction was started. Default Output |
|
|
The current status of the transaction ( |
|
|
The time that has elapsed since the transaction was started. Default Output |
|
|
The number of bytes allocated on the heap so far by the transaction, or |
|
|
The ID of this transaction’s outer transaction, if such exists, otherwise an empty string. For details, see |
|
|
Any metadata associated with the transaction, or an empty map if there is none. |
|
|
A map containing all the parameters used by the query currently executing in this transaction, or an empty map if no query is currently executing. |
|
|
The name of the Cypher planner used to plan the query currently executing in this transaction, or an empty string if no query is currently executing. For details, see Cypher planner. |
|
|
The name of the Cypher runtime used by the query currently executing in this transaction, or an empty string if no query is currently executing. For details, see Cypher runtime. |
|
|
The indexes utilised by the query currently executing in this transaction, or an empty list if no query is currently executing. |
|
|
The protocol used by the connection issuing the transaction. This is not necessarily an internet protocol, such as http, et.c., although it could be. It might also be "embedded", for example, if this connection represents an embedded session. |
|
|
The request URI used by the client connection issuing the transaction, or |
|
|
Provide additional status details from the underlying transaction or an empty string if none is available. |
|
|
Information about any blocked transactions, or an empty map if there is none. |
|
|
Count of active locks held by the transaction. |
|
|
CPU time that has been actively spent executing the transaction, or |
|
|
Wait time that has been spent waiting to acquire locks. |
|
|
Idle time for this transaction, or |
|
|
Amount of off-heap (native) memory allocated by the transaction in bytes, or |
|
|
The estimated amount of used heap memory allocated by the transaction in bytes, or |
|
|
The total number of page cache hits that the transaction performed. |
|
|
The total number of page cache faults that the transaction performed. |
|
|
The initialization stacktrace for this transaction, or an empty string if unavailable. |
|
Syntax
More details about the syntax descriptions can be found here. |
- List transactions on the current server
SHOW TRANSACTION[S] [transaction-id[,...]]
[YIELD { * | field[, ...] } [ORDER BY field[, ...]] [SKIP n] [LIMIT n]]
[WHERE expression]
[RETURN field[, ...] [ORDER BY field[, ...]] [SKIP n] [LIMIT n]]
The format of transaction-id
is <databaseName>-transaction-<id>
. Transaction IDs must be supplied as a comma-separated list of one or more quoted strings, a string parameter, or a list parameter.
When using the |
A user with the SHOW TRANSACTION
privilege can view the currently executing transactions in accordance with the privilege grants.
All users may view all of their own currently executing transactions.
Listing all transactions
To list all available transactions with the default output columns, use the SHOW TRANSACTIONS
command.
If all columns are required, use SHOW TRANSACTIONS YIELD *
.
SHOW TRANSACTIONS
database | transactionId | currentQueryId | connectionId | clientAddress | username | currentQuery | startTime | status | elapsedTime | allocatedBytes |
---|---|---|---|---|---|---|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Rows: 2 |
Listing transactions with filtering on output columns
The listed transactions can be filtered by using the WHERE
clause.
For example, getting the databases for all transactions where the currently executing query contains 'Mark'
:
SHOW TRANSACTIONS YIELD database, currentQuery WHERE currentQuery contains 'Mark'
database | currentQuery |
---|---|
|
|
|
|
Rows: 2 |
Several of the output columns have the duration
type, which can be hard to read.
They can instead be returned in a more readable format:
SHOW TRANSACTIONS
YIELD transactionId, elapsedTime, cpuTime, waitTime, idleTime
RETURN
transactionId AS txId,
elapsedTime.milliseconds AS elapsedTimeMillis,
cpuTime.milliseconds AS cpuTimeMillis,
waitTime.milliseconds AS waitTimeMillis,
idleTime.seconds AS idleTimeSeconds
txId | elapsedTimeMillis | cpuTimeMillis | waitTimeMillis | idleTimeSeconds |
---|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Rows: 3 |
Listing specific transactions
It is possible to specify which transactions to return in the list by transaction ID.
SHOW TRANSACTIONS "neo4j-transaction-3"
database | transactionId | currentQueryId | connectionId | clientAddress | username | currentQuery | startTime | status | elapsedTime | allocatedBytes |
---|---|---|---|---|---|---|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
Rows: 1 |
TERMINATE TRANSACTIONS
The TERMINATE TRANSACTIONS
command is used to terminate running transactions by their IDs.
This command will produce a table with the following columns:
Column | Description | Type |
---|---|---|
|
The transaction ID. |
|
|
The username of the user executing the transaction. |
|
|
The result of the |
|
Syntax
More details about the syntax descriptions can be found here. |
- Terminate transactions by ID on the current server
TERMINATE TRANSACTION[S] transaction_id[, ...]
The format of transaction-id
is <databaseName>-transaction-<id>
. Transaction IDs must be supplied as a comma-separated list of one or more quoted strings, a string parameter, or a list parameter.
A user with the TERMINATE TRANSACTION
privilege can terminate transactions in accordance with the privilege grants.
All users may terminate their own currently executing transactions.
Terminate transactions
To end running transactions without waiting for them to complete on their own, use the TERMINATE TRANSACTIONS
command.
TERMINATE TRANSACTIONS "neo4j-transaction-1","neo4j-transaction-2"
transactionId | username | message |
---|---|---|
|
|
|
|
|
|
Rows: 2 |