🎨 Manually optimize the data index to reduce space usage and improve performance https://github.com/siyuan-note/siyuan/issues/15663

This commit is contained in:
Daniel 2025-08-25 11:23:42 +08:00
parent 8895613f8b
commit 34360fb9e3
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
15 changed files with 98 additions and 14 deletions

View file

@ -1533,3 +1533,22 @@ func SQLTemplateFuncs(templateFuncMap *template.FuncMap) {
return
}
}
func Vacuum() {
if nil != db {
if _, err := db.Exec("VACUUM"); nil != err {
logging.LogErrorf("vacuum database failed: %s", err)
}
}
if nil != historyDB {
if _, err := historyDB.Exec("VACUUM"); nil != err {
logging.LogErrorf("vacuum history database failed: %s", err)
}
}
if nil != assetContentDB {
if _, err := assetContentDB.Exec("VACUUM"); nil != err {
logging.LogErrorf("vacuum asset content database failed: %s", err)
}
}
return
}