Manage transactions

Configure transaction timeout

It is recommended to configure Neo4j to terminate transactions whose execution time has exceeded the configured timeout.

  • Set db.transaction.timeout to some positive time interval value (e.g.,10s) denoting the default transaction timeout. Setting db.transaction.timeout to 0 — which is the default value — disables the feature.

  • You can also set this dynamically on each instance (Read Replicas only if required) using the procedure dbms.setConfigValue('db.transaction.timeout','10s').

Example 1. Configure transaction timeout

Set the timeout to ten seconds.

db.transaction.timeout=10s

Configuring transaction timeout has no effect on transactions executed with custom timeouts (e.g., via the Java API or Neo4j Drivers), as the custom timeout overrides the value set for db.transaction.timeout. Note that the timeout value can only be overridden to a value that is smaller than that configured by db.transaction.timeout.

The transaction timeout feature is also known as the transaction guard.

Configure lock acquisition timeout

An executing transaction may get stuck while waiting for some lock to be released by another transaction. To kill that transaction and remove the lock, set set db.lock.acquisition.timeout to some positive time interval value (e.g., 10s) denoting the maximum time interval within which any particular lock should be acquired, before failing the transaction. Setting db.lock.acquisition.timeout to 0 — which is the default value — disables the lock acquisition timeout.

This feature cannot be set dynamically.

Example 2. Configure lock acquisition timeout

Set the timeout to ten seconds.

db.lock.acquisition.timeout=10s

List all running transactions

To list the currently running transactions within an instance, use the SHOW TRANSACTIONS command.

The SHOW TRANSACTION privilege determines what transactions are returned by the command. However, the current user can always view all of their own currently executing transactions.

Syntax:

SHOW TRANSACTIONS

For more information on this command, see the Cypher manual → SHOW TRANSACTIONS command.