SQLite expression index
A SQLite expression index stores keys computed from table-column expressions rather than only copied column values.
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. [2] [1]
A 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. [5]
Relations
- related
- sqlite-collation, sqlite-quick-check, sqlite-integrity-check, backup-verification
Citations
- SQLite: Deterministic SQL Functions, sections 2 and 4
- SQLite: Indexes On Expressions, restrictions
- Hesela: SQLite index runtime experiment
Further reading
- SQLite: Stale Expression Indexes, platform variation and version-scoped recovery
- SQLite REINDEX: rebuild scope and name resolution
Sources & caveats
- Constructed fixtures on SQLite 3.45.1; callback changes deliberately violate existing index assumptions. No defect, incident-rate or cross-platform migration claim.
Published by Hesela team · Updated
Report a correction · Editorial standards · Reuse guidance
Cite this page
Hesela team. SQLite expression index. Hesela. 2026-10-18. https://hesela.dev/terms/sqlite-expression-index/