{
  "slug": "sqlite-immutable",
  "term": "SQLite immutable connection",
  "aliases": [
    "SQLite immutable=1"
  ],
  "definition": "A SQLite immutable connection treats its database file as permanently unchanging and skips locking and change detection.",
  "note": "The immutable URI parameter is a caller promise, not a mechanism that freezes a file. It opens the database read-only, but is stronger than mode=ro: another writer must not change the file. Violating the promise can produce incorrect results or SQLITE_CORRUPT. [sqlite-uri]\n\nIn a constructed DELETE-journal schedule, an immutable connection kept generation 0 after a writer committed generation 1; a fresh connection saw 1. In the WAL schedule, both retained and fresh immutable connections saw main-file generation 0 while an ordinary reader saw committed generation 2. All those read views passed integrity_check. [hesela-data]\n\nNormal read-only WAL access still participates in the WAL protocol. It needs readable sidecar files or permission to create them. Immutable is not a generic workaround for those permissions. For fixed read-only distribution, SQLite recommends preparing the database in DELETE journal mode. [sqlite-wal-readonly]",
  "status": "shipping",
  "advantages": [],
  "limitations": [],
  "provenance": [
    "The mutable cases deliberately violate the API precondition; they are not evidence of a SQLite defect or a guaranteed outcome after misuse. [hesela-readers]",
    "Observed on SQLite 3.45.1 with sequential calls, private caches and mmap disabled. No crash, power loss, network filesystem or physical-I/O tracing. [hesela-data]"
  ],
  "related": [
    "sqlite-query-only",
    "sqlite-wal-end-mark",
    "sqlite-integrity-check",
    "backup-verification"
  ],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "citations": [
    {
      "id": "sqlite-uri",
      "title": "SQLite: URI parameters, mode and immutable",
      "url": "https://www.sqlite.org/uri.html",
      "accessed": "2026-10-17"
    },
    {
      "id": "hesela-readers",
      "title": "Hesela: measured SQLite reader contracts, nine constructed schedules",
      "url": "https://hesela.com/analyses/sqlite-wal-checkpoint-starvation/#immutable-readers",
      "accessed": "2026-10-17"
    },
    {
      "id": "hesela-data",
      "title": "Hesela: SQLite immutable-reader observations and provenance",
      "url": "https://hesela.dev/research/sqlite-immutable-readers.json",
      "accessed": "2026-10-17"
    },
    {
      "id": "sqlite-wal-readonly",
      "title": "SQLite: Write-Ahead Logging, section 5, read-only databases",
      "url": "https://www.sqlite.org/wal.html#read_only_databases",
      "accessed": "2026-10-17"
    }
  ],
  "updated": "2026-10-17"
}
