Parcourir la source

:zap: Improve data indexing performance for creating documents Fix https://github.com/siyuan-note/siyuan/issues/11005

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

+ 5 - 0
kernel/sql/database.go

@@ -999,6 +999,11 @@ func deleteBlocksByIDs(tx *sql.Tx, ids []string) (err error) {
 		rowIDs = append(rowIDs, strconv.FormatInt(rowID, 10))
 		rowIDs = append(rowIDs, strconv.FormatInt(rowID, 10))
 	}
 	}
 	rows.Close()
 	rows.Close()
+
+	if 1 > len(rowIDs) {
+		return
+	}
+
 	stmt = "DELETE FROM blocks WHERE ROWID IN (" + strings.Join(rowIDs, ",") + ")"
 	stmt = "DELETE FROM blocks WHERE ROWID IN (" + strings.Join(rowIDs, ",") + ")"
 	if err = execStmtTx(tx, stmt); nil != err {
 	if err = execStmtTx(tx, stmt); nil != err {
 		return
 		return