Database operations that access the graph, indexes, or schema are performed in a transaction to ensure the ACID properties. Transactions are single-threaded, confined, and independent. Multiple transactions can be started in a single thread and they are independent of each other.
The interaction cycle of working with transactions follows the steps:
Begin a transaction.
Perform database operations.
Commit or roll back the transaction.
It is crucial to finish each transaction because the locks or memory acquired by a transaction are only released upon completion. All non-committed transactions are rolled back as part of resource cleanup at the end of the statement. No resource cleanup is required for a transaction that is explicitly committed or rolled back, and the transaction closure is an empty operation.
All modifications performed in a transaction are kept in memory. This means that very large updates must be split into several transactions to avoid running out of memory.
The transaction settings help you manage the transactions in your database, for example, the transaction timeout, the maximum number of concurrently running transactions, how much time to allow Neo4j to wait for running transactions to complete before allowing initiated database shutdown to continue, and so on. For all available settings, see Transaction settings.
By default, Neo4j can run a maximum of 1000 concurrent transactions.
To change this value, use the
If set to
0, the limit is disabled.
It is recommended to configure Neo4j to terminate transactions whose execution time has exceeded the configured timeout.
db.transaction.timeoutto some positive time interval value (e.g.,
10s) denoting the default transaction timeout. Setting
0— which is the default value — disables the feature.
You can also set this dynamically on each primary server using the procedure
Set the timeout to ten seconds.
Configuring transaction timeout does not affect transactions executed with custom timeouts (e.g., via the Java API or Neo4j Drivers), as the custom timeout overrides the value set for
Note that the timeout value can only be overridden to a value that is smaller than that configured by
Transactions can be managed using the Cypher commands
SHOW TRANSACTIONS and
TERMINATE TRANSACTIONS command can be combined with multiple
SHOW TRANSACTIONS and
TERMINATE TRANSACTIONS commands in the same query.
For more information, see Cypher manual → Transaction commands.
Was this page helpful?