Database internals and transactional behavior

To maintain data integrity and ensure reliable transactional behavior, Neo4j DBMS supports transactions with full ACID properties, and it uses a write-ahead transaction log to ensure durability.

  • Atomicity — If a part of a transaction fails, the database state is left unchanged.

  • Consistency — Every transaction leaves the database in a consistent state.

  • Isolation — During a transaction, modified data cannot be accessed by other operations.

  • Durability — The DBMS can always recover the results of a committed transaction.

Neo4j DBMS supports the following transactional behavior:

  • All database operations that access the graph, indexes, or schema must be performed in a transaction.

  • The default isolation level is read-committed isolation level.

  • Write locks are acquired automatically at the node and relationship levels. However, you can also manually acquire write locks if you want to achieve a higher level of isolation — serializable isolation level.

  • Data retrieved by traversals is not protected from modification by other transactions.

  • Non-repeatable reads may occur (i.e., only write locks are acquired and held until the end of the transaction).

  • Deadlock detection is built into the core transaction management.

The following sections describe the transactional behavior in detail and how to control it:

For information on Neo4j 4.4, see Java Reference 4.4 → Transaction management.