We’re overhauling Dgraph’s docs to make them clearer and more approachable. If
you notice any issues during this transition or have suggestions, please
let us know.
Transactions
Dgraph clients perform mutations and queries using transactions. A transaction bounds a sequence of queries and mutations that are committed by Dgraph as a single unit: that’s, on commit, either all the changes are accepted by Dgraph or none are. A transaction always sees the database state at the moment it began, plus any changes it makes --- changes from concurrent transactions aren’t visible. On commit, Dgraph aborts a transaction, rather than committing changes, when a conflicting, concurrently running transaction has already been committed. Two transactions conflict when both transactions:- write values to the same scalar predicate of the same node (e.g both
attempting to set a particular node’s
addresspredicate); or - write to a singular
uidpredicate of the same node (changes to[uid]predicates can be concurrently written); or - write a value that conflicts on an index for a predicate with
@upsertset in the schema (see upserts).
For additional clients, see Unofficial
Clients.