When introducing the idea of using Neo4j within an enterprise one common assumption is that because Neo4j is a graph database it must not provide ACID-compliance that RDBMS has delivered for so long. This assumption isn’t unfounded considering most of the NoSQL database solutions have moved towards a performance and availability at all costs model. But it’s a fact: Neo4j is a fully ACID-compliant and transactional database intended to be a secure and safe source of truth database for your enterprise.

Neo4j is a reliable, scalable and high-performing native graph database that’s suitable for enterprise use. Its proper ACID characteristics is a foundation of data reliability. Neo4j ensures that operations involving the modification of data happen within a transaction to guarantee consistent data.

This is especially important in graph because the paradigm for writing data reliably shifts when you introduce the concept of a relationship that is a primary entity within the database. To write a relationship reliably requires locking both the nodes it’s connected to in order to guarantee that they both agree on that relationship between them.

What is ACID?

Atomicity requires that a transaction is all or nothing, which means if a portion of a transaction fails, the state of the database is left without changes.

requires that a transaction is all or nothing, which means if a portion of a transaction fails, the state of the database is left without changes. Consistency ensures any transactional operation will leave the database at a consistent state as defined by constraints, etc applied to the database.

ensures any transactional operation will leave the database at a consistent state as defined by constraints, etc applied to the database. Isolation guarantees concurrent transactions will execute as if they were performed sequentially requiring that within a transaction, altered data won’t be accessed by other operations prior to commit.

guarantees concurrent transactions will execute as if they were performed sequentially requiring that within a transaction, altered data won’t be accessed by other operations prior to commit. Durability means that once a transaction has been committed it will remain even if the database crashes immediately thereafter.

Neo4j ACID Overview

Database operations accessing the indexes, graph, or schema should be carried out within a transaction.

READ_COMMITTED is the default isolation level.

Data taken by traversals isn’t shielded from modification from other transactions.

Non-repeated reads could happen (example: write locks are only acquired and held until the end point of a transaction).

Write locks can be acquired manually on relationships and nodes to acquire higher isolation level.

Locks can be acquired only at the node and relationship level.

Detection of deadlock is created into the transaction management core.

For those that may not know or need a refresher as to what that acronym includes, heres a quick summary. ACID is a set of properties that guarantee database transactions are processed reliably and a transaction is a single logical operation on the database.To completely preserve integrity of data while ensuring adequate transactional behavior, Neo4j supports properties of ACID and below is a quick overview of some of the specific implementation:

In summary, Neo4j is an enterprise ready native graph database that is designed to be your source of truth transactional datastore. We’ve been using it in this way for years and so have many of the world’s leading enterprises.