dev.to | 📄 原文链接 | 2026-09-11 收录

SQLite 3.53 的自愈索引,只修你实际写入的那几行

来源:dev.to — 2026-09-10

📋 概述

作者故意制造了一个陈旧表达式索引:自定义函数 classify(x) 的行为被「修复」后,索引里存的仍是旧值,于是同一条查询走索引得到 308、走全表扫描得到 309,而数据库一声不响。在 3.53.4 上,自愈机制只修好了他真正写入的 21 行,剩下 979 行依旧错着,直到执行 REINDEX EXPRESSIONS 才全部恢复;代价是每次写入都要多付一点自愈开销。

🔑 核心要点

💡 金句

No error, no warning, just a wrong answer served from an index that no longer matched the function that built it.
← 返回 dev.to 首页