Chapter 18. Transaction Management

In order to fully maintain data integrity and ensure good transactional behavior, Neo4j supports the ACID properties:

  • atomicity: If any part of a transaction fails, the database state is left unchanged.
  • consistency: Any transaction will leave 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.

Specifically:

  • All database operations that access the graph, indexes, or the schema must be performed in a transaction.
  • The default isolation level is READ_COMMITTED.
  • 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).
  • One can manually acquire write locks on nodes and relationships to achieve higher level of isolation (SERIALIZABLE).
  • Locks are acquired at the Node and Relationship level.
  • Deadlock detection is built into the core transaction management.