浏览代码

:art: Add the parent_id index for table blocks https://github.com/siyuan-note/siyuan/issues/12054

Daniel 1 年之前
父节点
当前提交
b763b4d482
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. 5 0
      kernel/sql/database.go

+ 5 - 0
kernel/sql/database.go

@@ -135,6 +135,11 @@ func initDBTables() {
 		logging.LogFatalf(logging.ExitCodeReadOnlyDatabase, "create index [idx_blocks_id] failed: %s", err)
 	}
 
+	_, err = db.Exec("CREATE INDEX idx_blocks_parent_id ON blocks(parent_id)")
+	if nil != err {
+		logging.LogFatalf(logging.ExitCodeReadOnlyDatabase, "create index [idx_blocks_parent_id] failed: %s", err)
+	}
+
 	_, err = db.Exec("CREATE INDEX idx_blocks_root_id ON blocks(root_id)")
 	if nil != err {
 		logging.LogFatalf(logging.ExitCodeReadOnlyDatabase, "create index [idx_blocks_root_id] failed: %s", err)