{
  "slug": "sqlite-expression-index",
  "term": "SQLite expression index",
  "aliases": [
    "expression index",
    "stale expression index"
  ],
  "definition": "A SQLite expression index stores keys computed from table-column expressions rather than only copied column values.",
  "note": "Functions used in indexed expressions must remain deterministic across the database lifetime. Marking an application-defined function deterministic does not preserve its implementation or prevent a later change from making stored keys stale. [expression] [deterministic]\n\nA controlled three-row fixture changed score(x) from x to x+100 under the same name: the old index returned no match for 102 while a table scan returned row 2. The file hash was unchanged; quick_check returned ok and integrity_check diagnosed missing index entries. Targeted rebuilding restored agreement. [experiment]",
  "related": [
    "sqlite-collation",
    "sqlite-quick-check",
    "sqlite-integrity-check",
    "backup-verification"
  ],
  "citations": [
    {
      "id": "deterministic",
      "title": "SQLite: Deterministic SQL Functions, sections 2 and 4",
      "url": "https://sqlite.org/deterministic.html",
      "accessed": "2026-10-18"
    },
    {
      "id": "expression",
      "title": "SQLite: Indexes On Expressions, restrictions",
      "url": "https://sqlite.org/expridx.html",
      "accessed": "2026-10-18"
    },
    {
      "id": "stale",
      "title": "SQLite: Stale Expression Indexes, platform variation and version-scoped recovery",
      "url": "https://sqlite.org/staleexpridx.html",
      "accessed": "2026-10-18"
    },
    {
      "id": "reindex",
      "title": "SQLite REINDEX: rebuild scope and name resolution",
      "url": "https://www.sqlite.org/lang_reindex.html",
      "accessed": "2026-10-18"
    },
    {
      "id": "experiment",
      "title": "Hesela: SQLite index runtime experiment",
      "url": "https://hesela.com/analyses/sqlite-index-runtime-dependencies/",
      "accessed": "2026-10-18"
    }
  ],
  "status": "shipping",
  "advantages": [],
  "limitations": [],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-10-18",
  "provenance": [
    "Constructed fixtures on SQLite 3.45.1; callback changes deliberately violate existing index assumptions. No defect, incident-rate or cross-platform migration claim."
  ]
}
