15.7. Transactions

Any query that updates the graph will run in a transaction. An updating query will always either fully succeed, or not succeed at all.

Cypher will either create a new transaction, and commit it once the query finishes. Or if a transaction already exists in the running context, the query will run inside it, and nothing will be persisted to disk until the transaction is successfully committed.

This can be used to have multiple queries be committed as a single transaction:

  1. Open a transaction,
  2. run multiple updating Cypher queries,
  3. and commit all of them in one go.

Note that a query will hold the changes in heap until the whole query has finished executing. A large query will consequently need a JVM with lots of heap space.