Improve data indexing to reduce disk read operations https://github.com/siyuan-note/siyuan/issues/16958

Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
Daniel 2026-02-06 12:08:49 +08:00
parent 6f7cd7f78f
commit dc00060062
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -147,6 +147,11 @@ func initDBTables() {
logging.LogFatalf(logging.ExitCodeUnavailableDatabase, "create index [idx_blocks_root_id] failed: %s", err)
}
_, err = db.Exec("CREATE INDEX idx_blocks_root_id_id_hash ON blocks(root_id, id, hash)")
if err != nil {
logging.LogFatalf(logging.ExitCodeUnavailableDatabase, "create index [idx_blocks_root_id_id_hash] failed: %s", err)
}
_, err = db.Exec("DROP TABLE IF EXISTS blocks_fts")
if err != nil {
logging.LogFatalf(logging.ExitCodeUnavailableDatabase, "drop table [blocks_fts] failed: %s", err)