| Previous | Next |
| SQLITE_E_NOTICE_RECOVER_WAL | SQLITE_E_ABORT_ROLLBACK |
SQLITE_E_WARNING_AUTOINDEX
SQLITE_E_WARNING_AUTOINDEX (0x87AF011C) represents SQLite query planner created a transient automatic index. This extended warning is emitted when SQLite builds an automatic index to improve a query that lacks a suitable persistent index. The query can still succeed, but repeated warnings may expose avoidable planning and build cost. For SQLITE_E_WARNING_AUTOINDEX, apply the native SQLite state-machine rules even though Windows stores the result in an HRESULT facility.
Capture the plan
- Record the exact SQL and bound-value shape.
- Run EXPLAIN QUERY PLAN against a representative database.
- Keep table cardinalities and existing index definitions.
Interpretation
| Workload | Decision |
|---|---|
| Occasional small query | The automatic index cost may be acceptable. |
| Hot or large join | A persistent index might reduce repeated construction work. |
| Changing workload | One index chosen from a single sample may harm writes or other plans. |
Measure before adding an index
- Benchmark with production-like data
- Create the candidate index in a disposable copy
- Compare read latency, write cost, file size, and planner choice
Verification
The chosen schema or query plan removes the repeated warning under the target workload without regressing writes. Disabling automatic indexes globally is not evidence of improvement.
Use planner evidence, not warning suppression
Refresh representative statistics when appropriate and compare EXPLAIN QUERY PLAN before and after a candidate index. A persistent index should match the real join and filter pattern; adding every warned column can increase write amplification and still leave the planner choosing a transient index. Retest after realistic data growth rather than only on a tiny development database.
Questions that narrow SQLITE_E_WARNING_AUTOINDEX
| Question | Diagnostic direction |
|---|---|
| Same input rejected elsewhere | Agreement at the same offset supports a representation or contract cause |
| Known-good sample fails locally | Attention shifts to local libraries, state, packaging, or configuration |
| Clean process behaves differently | Look for mutation, leaked state, concurrency, or cached negotiation |
| Boundary control no longer fails | Validation may have been disabled rather than corrected |
Preserve causal order for SQLITE_E_WARNING_AUTOINDEX
Timestamp acquisition, parsing or preparation, the call returning SQLITE_E_WARNING_AUTOINDEX, automatic retry, and cleanup so a later network, storage, or disposal result cannot replace the original cause.
SQLite object lifetimes for SQLITE_E_WARNING_AUTOINDEX
| Object | Record |
|---|---|
| Database connection | Open flags, threading mode, transaction state, and latest connection error |
| Prepared statement | SQL identity, bindings, prepare API, and step call |
| Current row | Column values governed by the documented SQLITE_ROW lifetime |
| Log callback | Extended code and message retained even when the active API succeeds |
Native SQLite identity behind SQLITE_E_WARNING_AUTOINDEX
Keep the primary and extended SQLite result before mapping it to SQLITE_E_WARNING_AUTOINDEX, because masking the low byte or treating every HRESULT alike can erase the distinction among ROW, DONE, NOTICE, WARNING, and an extended warning.
Cleanup paths for SQLITE_E_WARNING_AUTOINDEX
- Finalize every statement that will not be reused
- Reset reusable statements only at a documented terminal state
- Avoid recursive SQLite use from the configured log callback
- Verify rollback, commit, and close independently from this result
Decision boundary for SQLITE_E_WARNING_AUTOINDEX
| Evidence | Use |
|---|---|
| Direct API return | Determines control flow for prepare, step, reset, finalize, or transaction work |
| Extended result code | Preserves the specific SQLite condition before HRESULT translation |
| Log callback event | Adds diagnostics but does not automatically replace the direct API result |
| Transaction outcome | Separately determines whether completed statement work becomes durable |
Technical references for SQLITE_E_WARNING_AUTOINDEX
- SQLite result and extended result codes
- SQLite sqlite3_step contract
- SQLite error logging interface
- SQLite query planner and automatic indexes
Looking for a different code? Search another status or error code.