Parcourir la source

:zap: Optimize document moving and renaming performance https://github.com/siyuan-note/siyuan/issues/10560

Daniel il y a 1 an
Parent
commit
de02e66960
1 fichiers modifiés avec 5 ajouts et 0 suppressions
  1. 5 0
      kernel/sql/database.go

+ 5 - 0
kernel/sql/database.go

@@ -130,6 +130,11 @@ func initDBTables() {
 		logging.LogFatalf(logging.ExitCodeReadOnlyDatabase, "create table [blocks] failed: %s", err)
 		logging.LogFatalf(logging.ExitCodeReadOnlyDatabase, "create table [blocks] 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)
+	}
+
 	_, err = db.Exec("DROP TABLE IF EXISTS blocks_fts")
 	_, err = db.Exec("DROP TABLE IF EXISTS blocks_fts")
 	if nil != err {
 	if nil != err {
 		logging.LogFatalf(logging.ExitCodeReadOnlyDatabase, "drop table [blocks_fts] failed: %s", err)
 		logging.LogFatalf(logging.ExitCodeReadOnlyDatabase, "drop table [blocks_fts] failed: %s", err)