docs / transactions

Transactions

sql
BEGIN;                    -- default SNAPSHOT
BEGIN READ COMMITTED;
BEGIN SNAPSHOT;
BEGIN SERIALIZABLE;
COMMIT;
ROLLBACK;
LevelSnapshotLocks
READ COMMITTEDRefreshed each statementExclusive key locks until end of transaction
SNAPSHOTTaken at BEGINExclusive key locks; first-committer-wins on write-write
SERIALIZABLETaken at BEGINSnapshot plus shared key/range locks (strict 2PL)

SERIALIZABLE is lock-based, not SSI. Deadlock aborts the requester (deadlock); that transaction must ROLLBACK.

Readers do not see uncommitted writes. Commit is acknowledged only after group-commit WAL + fsync.

Without BEGIN, each statement is its own committed transaction. nextsql exec sends one statement per invocation, so multi-statement transactions need a driver.

On a Raft cluster, a write is acknowledged only after the leader flushes its local WAL and a quorum commits the sealed replication batch. SQL is not re-executed on followers, so UUID() / NOW() / AI() stay deterministic. See high availability.

Engine notes: `docs/mvcc.md`, `docs/wal.md`.

0.1.0-dev · GitHub