FTS5 external-content table
An FTS5 external-content table stores a full-text index while retrieving document values from another database object.
The content option names the document source; content_rowid selects its key. Application logic must maintain both source and index. Triggers added after existing documents do not backfill them: in the fixture, a plain read returned three rows but MATCH found only the later insert. Rebuild restored search coverage. [1] [3]
Base-table REPLACE with recursive_triggers off left an old alpha posting that returned the new delta row despite all maintenance triggers existing. Enabling recursive triggers caused delete then insert; the tested conflict-targeted UPSERT caused an update under either setting. These are ordinary-table writes, not direct virtual-table writes. [5] [4]
Only ordinary VACUUM on the implicit-rowid table without an ordinary index changed IDs 1/3/8 to 1/2/3 among nine cases per build on SQLite 3.45.1 and 3.53.1. MATCH charlie returned hotel. INTO, backup and the other schema controls preserved IDs in these fixtures, not as a general guarantee. [9] [6]
Use a true rowid alias such as id INTEGER PRIMARY KEY with matching content_rowid for persistent identity. INT PRIMARY KEY and inline INTEGER PRIMARY KEY DESC are not aliases. Rebuild repaired current searches, not old IDs or references. [8] [7] [9]
Recovery acceptance needs two separate comparisons: the earlier ID-to-text mapping and stored token instances against a fresh current-content index. A baseline created after damage cannot establish earlier contents. [10] [11]
Relations
- related
- Inverted index, FTS5 integrity-check, SQLite expression index, SQLite Online Backup API, SQLite REPLACE
Citations
- SQLite FTS5: external content and integrity checking
- Hesela: eight executed FTS5 states and full query results
- Hesela: four REPLACE/UPSERT cases with rollback, trigger events and full query results
- SQLite ON CONFLICT: REPLACE deletion and recursive triggers
- SQLite: VACUUM and unaliased rowid changes
- SQLite: rowid persistence and integer-key aliases
- SQLite: exact INTEGER PRIMARY KEY alias rules
- Hesela: nine maintenance-identity cases on each of two SQLite builds
- Hesela: historical-row and current-index acceptance, 17 designed cases
- SQLite FTS5: instance vocabulary and token positions
Further reading
Sources & caveats
- Designed fixtures on SQLite 3.45.1, default tokenizer and closed DELETE-journal files. Not a failure-rate estimate.
- Nine designed maintenance cases per build, closed DELETE journal and no concurrent writer. Independent source/prose review only; no independent native replication or incident-rate estimate. [9]
- The acceptance demonstrator uses fixed TEXT-only, unicode61, detail=full fixtures and a fresh index in the same SQLite engine. The baseline is known original input, not independently authenticated history or a general production checker. [10] [11]