{
  "slug": "sqlite-savepoint",
  "term": "SQLite savepoint",
  "aliases": [
    "SAVEPOINT",
    "ROLLBACK TO",
    "RELEASE SAVEPOINT"
  ],
  "definition": "A SQLite savepoint is a named transaction-stack boundary that permits partial rollback without necessarily ending the surrounding transaction.",
  "note": "SAVEPOINT can start an outer transaction or mark a point inside one. RELEASE removes the newest matching mark and younger marks. Inner release is not an independent commit: outer ROLLBACK can undo its writes. ROLLBACK TO undoes changes since the target, removes younger marks and retains the target for reuse. Successful RELEASE of the outermost mark commits. Names need not be unique. [savepoints]\n\nBEGIN transactions do not nest. After an execution error, check transaction state rather than assuming the enclosing transaction survived. [transactions] [autocommit]\n\nFour constructed cases in DELETE and WAL modes used explicit SQL through Python sqlite3. An inner insertion stayed invisible to another connection and disappeared on outer rollback; outermost RELEASE exposed it to a drained autocommit observer. Ordered steps and reopen results are retained. This is not a power-loss test. [experiment]\n\nCommit and WAL checkpoint progress are separate. Inner RELEASE proves neither outer completion nor history reclamation. [wal]\n\nOutermost RELEASE does not refresh an existing WAL reader snapshot. In two controls, BEGIN plus SELECT retained old rows until transaction end while a fresh connection saw the commit; BEGIN without an early read did not acquire the old snapshot. [isolation] [reader-control]\n\nARIES section 5.2 consumes a rollback target; SQLite retains it. Do not transfer savepoint lifetime rules between systems or infer SQLite implements ARIES. [aries]\n\nA BLOB-expiration control used ROLLBACK TO to undo earlier chunks and a same-row revision update, retaining a sentinel update made before the savepoint. Handle expiration alone did not undo those chunks. [blob-write] [blob-evidence]",
  "related": [
    "sqlite-transaction-state",
    "sqlite-wal-end-mark",
    "checkpoint-starvation"
  ],
  "citations": [
    {
      "id": "savepoints",
      "title": "SQLite: Savepoints, nesting and transaction-stack rules",
      "url": "https://www.sqlite.org/lang_savepoint.html",
      "accessed": "2026-11-13"
    },
    {
      "id": "transactions",
      "title": "SQLite: Transactions and response to errors",
      "url": "https://www.sqlite.org/lang_transaction.html",
      "accessed": "2026-11-13"
    },
    {
      "id": "autocommit",
      "title": "SQLite C API: Test For Auto-Commit Mode",
      "url": "https://www.sqlite.org/c3ref/get_autocommit.html",
      "accessed": "2026-11-13"
    },
    {
      "id": "wal",
      "title": "SQLite: Write-Ahead Logging, commit and checkpoint",
      "url": "https://www.sqlite.org/wal.html#how_wal_works",
      "accessed": "2026-11-13"
    },
    {
      "id": "experiment",
      "title": "Hesela: eight SQLite savepoint schedules, complete observations",
      "url": "https://hesela.dev/research/sqlite-savepoint/results.json",
      "accessed": "2026-11-13"
    },
    {
      "id": "analysis",
      "title": "Hesela: SQLite savepoint release versus transaction completion",
      "url": "https://hesela.com/analyses/sqlite-wal-checkpoint-starvation/#savepoint-boundaries",
      "accessed": "2026-11-13"
    },
    {
      "id": "isolation",
      "title": "SQLite: Isolation, WAL snapshots and read-transaction lifetime",
      "url": "https://www.sqlite.org/isolation.html",
      "accessed": "2026-11-13"
    },
    {
      "id": "reader-control",
      "title": "Hesela: WAL savepoint release and retained-reader control",
      "url": "https://hesela.dev/research/sqlite-savepoint/reader-snapshot.json",
      "accessed": "2026-11-13"
    },
    {
      "id": "aries",
      "title": "Mohan et al. ARIES. ACM TODS 17(1), 94-162 (1992), section 5.2, pp. 117-118. DOI 10.1145/128765.128770.",
      "url": "https://www.cs.cmu.edu/~natassa/courses/15-721/papers/p94-mohan.pdf",
      "accessed": "2026-11-13"
    },
    {
      "id": "blob-write",
      "title": "SQLite C API: expired BLOB writes and preservation of earlier changes",
      "url": "https://www.sqlite.org/c3ref/blob_write.html",
      "accessed": "2026-11-15"
    },
    {
      "id": "blob-evidence",
      "title": "Hesela: 40 native BLOB-expiration controls on two SQLite builds",
      "url": "https://hesela.dev/research/sqlite-blob-expiration/summary.json",
      "accessed": "2026-11-15"
    }
  ],
  "status": "shipping",
  "advantages": [],
  "limitations": [
    "A savepoint is not an independently durable nested transaction or a backup."
  ],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-11-15",
  "provenance": [
    "Source synthesis plus deterministic SQL fixtures on the recorded runtime; no crash, I/O-fault or physical-persistence experiment.",
    "BLOB controls used ten schedules, two journal modes and SQLite 3.45.1/3.54.1 on one host. No concurrent writer, power-loss test, new-defect claim or population estimate. [blob-evidence]"
  ]
}
