storage-fts-is-derived-index
IN premise
The FTS5 full-text search index is rebuilt from scratch during every `save()`; it is a derived index, never the source of truth.
Summary
The full-text search index is disposable and always reconstructable. Every time data is saved, the search index gets wiped and rebuilt from the primary data, so you never need to worry about the search index getting out of sync or losing data if it gets corrupted — just save again and it comes back.
Dependents
These beliefs depend on this one:
- search-is-resilient-across-index-states — Search operates correctly regardless of FTS5 index availability: the index is derived (rebuilt from scratch on every save) so stale indexes are self-healing, and search falls back to substring matching when FTS tables don't exist or error
- storage-optimizes-concurrent-access-and-search — The storage layer optimizes for both concurrent access (WAL mode enables non-blocking reads during writes) and full-text search (derived FTS5 index rebuilt from scratch on every save guarantees consistency), making the persistence layer production-ready for multi-reader workloads with search capability.
Details
| Source | entries/2026/04/24/reasons_lib-storage.md |