mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-09-22 00:20:47 +02:00
🎨 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:
parent
8895613f8b
commit
34360fb9e3
15 changed files with 98 additions and 14 deletions
|
@ -1654,6 +1654,8 @@
|
||||||
"266": "Tesseract OCR غير مثبت أو غير مهيأ، يرجى الرجوع إلى دليل المستخدم - قسم ملفات الموارد لإجراء الإعداد",
|
"266": "Tesseract OCR غير مثبت أو غير مهيأ، يرجى الرجوع إلى دليل المستخدم - قسم ملفات الموارد لإجراء الإعداد",
|
||||||
"267": "قاعدة بيانات غير مسماة",
|
"267": "قاعدة بيانات غير مسماة",
|
||||||
"268": "يرجى ملاحظة أن الملف [%s] قد تجاوز بالفعل [%d MB]، وقد يؤدي ذلك إلى انخفاض الأداء",
|
"268": "يرجى ملاحظة أن الملف [%s] قد تجاوز بالفعل [%d MB]، وقد يؤدي ذلك إلى انخفاض الأداء",
|
||||||
"269": "تمت إضافة هذا المقطع بالفعل إلى قاعدة البيانات [%s]"
|
"269": "تمت إضافة هذا المقطع بالفعل إلى قاعدة البيانات [%s]",
|
||||||
|
"270": "يتم تحسين فهرس البيانات، يرجى الانتظار...",
|
||||||
|
"271": "اكتملت عملية تحسين فهرس البيانات، تم تحرير [%s] من مساحة القرص"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1654,6 +1654,8 @@
|
||||||
"266": "Tesseract OCR ist nicht installiert oder konfiguriert, bitte lesen Sie das Benutzerhandbuch - Abschnitt Ressourcen-Dateien zur Konfiguration",
|
"266": "Tesseract OCR ist nicht installiert oder konfiguriert, bitte lesen Sie das Benutzerhandbuch - Abschnitt Ressourcen-Dateien zur Konfiguration",
|
||||||
"267": "Unbenannte Datenbank",
|
"267": "Unbenannte Datenbank",
|
||||||
"268": "Bitte beachten Sie, dass die Datei [%s] bereits [%d MB] überschritten hat, was die Leistung beeinträchtigen kann",
|
"268": "Bitte beachten Sie, dass die Datei [%s] bereits [%d MB] überschritten hat, was die Leistung beeinträchtigen kann",
|
||||||
"269": "Dieser Block wurde bereits zur Datenbank [%s] hinzugefügt"
|
"269": "Dieser Block wurde bereits zur Datenbank [%s] hinzugefügt",
|
||||||
|
"270": "Datenindex wird optimiert, bitte warten...",
|
||||||
|
"271": "Datenindex-Optimierung abgeschlossen, [%s] Speicherplatz freigegeben"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1654,6 +1654,8 @@
|
||||||
"266": "Tesseract OCR is not installed or configured, please refer to the User Guide - Assets section for configuration",
|
"266": "Tesseract OCR is not installed or configured, please refer to the User Guide - Assets section for configuration",
|
||||||
"267": "Unnamed database",
|
"267": "Unnamed database",
|
||||||
"268": "Please note that the file [%s] has already exceeded [%d MB], which may cause performance degradation",
|
"268": "Please note that the file [%s] has already exceeded [%d MB], which may cause performance degradation",
|
||||||
"269": "This block has already been added to the database [%s]"
|
"269": "This block has already been added to the database [%s]",
|
||||||
|
"270": "Optimizing data index, please wait...",
|
||||||
|
"271": "Data index optimization completed, [%s] disk space freed"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1654,6 +1654,8 @@
|
||||||
"266": "Tesseract OCR no está instalado o configurado, consulte la Guía del Usuario - Sección de archivos de recursos para la configuración",
|
"266": "Tesseract OCR no está instalado o configurado, consulte la Guía del Usuario - Sección de archivos de recursos para la configuración",
|
||||||
"267": "Base de datos sin nombre",
|
"267": "Base de datos sin nombre",
|
||||||
"268": "Atención: el archivo [%s] ya ha superado los [%d MB], lo que puede causar una disminución del rendimiento",
|
"268": "Atención: el archivo [%s] ya ha superado los [%d MB], lo que puede causar una disminución del rendimiento",
|
||||||
"269": "Este bloque ya ha sido añadido a la base de datos [%s]"
|
"269": "Este bloque ya ha sido añadido a la base de datos [%s]",
|
||||||
|
"270": "Optimizando el índice de datos, por favor espere...",
|
||||||
|
"271": "Optimización del índice de datos completada, se liberaron [%s] de espacio en disco"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1654,6 +1654,8 @@
|
||||||
"266": "Tesseract OCR n'est pas installé ou configuré, veuillez consulter le Guide de l'utilisateur - Section des fichiers de ressources pour la configuration",
|
"266": "Tesseract OCR n'est pas installé ou configuré, veuillez consulter le Guide de l'utilisateur - Section des fichiers de ressources pour la configuration",
|
||||||
"267": "Base de données sans nom",
|
"267": "Base de données sans nom",
|
||||||
"268": "Attention : le fichier [%s] a déjà dépassé [%d MB], ce qui peut entraîner une baisse des performances",
|
"268": "Attention : le fichier [%s] a déjà dépassé [%d MB], ce qui peut entraîner une baisse des performances",
|
||||||
"269": "Ce bloc a déjà été ajouté à la base de données [%s]"
|
"269": "Ce bloc a déjà été ajouté à la base de données [%s]",
|
||||||
|
"270": "Optimisation de l’index des données en cours, veuillez patienter...",
|
||||||
|
"271": "Optimisation de l’index des données terminée, [%s] d’espace disque libéré"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1654,6 +1654,8 @@
|
||||||
"266": "Tesseract OCR לא הותקן או הוגדר, אנא עיין במדריך למשתמש - פרק קבצי משאבים לצורך הגדרה",
|
"266": "Tesseract OCR לא הותקן או הוגדר, אנא עיין במדריך למשתמש - פרק קבצי משאבים לצורך הגדרה",
|
||||||
"267": "מסד נתונים ללא שם",
|
"267": "מסד נתונים ללא שם",
|
||||||
"268": "שים לב שהקובץ [%s] כבר חרג מ-[%d MB], דבר שעלול לגרום לירידה בביצועים",
|
"268": "שים לב שהקובץ [%s] כבר חרג מ-[%d MB], דבר שעלול לגרום לירידה בביצועים",
|
||||||
"269": "הבלוק נוסף כבר למסד הנתונים [%s]"
|
"269": "הבלוק נוסף כבר למסד הנתונים [%s]",
|
||||||
|
"270": "מתבצעת אופטימיזציה של אינדקס הנתונים, נא להמתין...",
|
||||||
|
"271": "אופטימיזציית אינדקס הנתונים הושלמה, שוחררו [%s] שטח דיסק"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1654,6 +1654,8 @@
|
||||||
"266": "Tesseract OCR non è installato o configurato, fare riferimento alla Guida utente - Sezione file di risorse per la configurazione",
|
"266": "Tesseract OCR non è installato o configurato, fare riferimento alla Guida utente - Sezione file di risorse per la configurazione",
|
||||||
"267": "Database senza nome",
|
"267": "Database senza nome",
|
||||||
"268": "Attenzione: il file [%s] ha già superato [%d MB], il che potrebbe causare un calo delle prestazioni",
|
"268": "Attenzione: il file [%s] ha già superato [%d MB], il che potrebbe causare un calo delle prestazioni",
|
||||||
"269": "Questo blocco è già stato aggiunto al database [%s]"
|
"269": "Questo blocco è già stato aggiunto al database [%s]",
|
||||||
|
"270": "Ottimizzazione dell'indice dei dati in corso, attendere prego...",
|
||||||
|
"271": "Ottimizzazione dell'indice dei dati completata, liberati [%s] di spazio su disco"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1654,6 +1654,8 @@
|
||||||
"266": "Tesseract OCR がインストールされていないか、設定されていません。ユーザーガイド - リソースファイルセクションを参照して設定してください",
|
"266": "Tesseract OCR がインストールされていないか、設定されていません。ユーザーガイド - リソースファイルセクションを参照して設定してください",
|
||||||
"267": "未命名のデータベース",
|
"267": "未命名のデータベース",
|
||||||
"268": "ファイル [%s] はすでに [%d MB] を超えており、パフォーマンスが低下する可能性があります",
|
"268": "ファイル [%s] はすでに [%d MB] を超えており、パフォーマンスが低下する可能性があります",
|
||||||
"269": "このブロックはすでにデータベース [%s] に追加されています"
|
"269": "このブロックはすでにデータベース [%s] に追加されています",
|
||||||
|
"270": "データインデックスを最適化しています。しばらくお待ちください...",
|
||||||
|
"271": "データインデックスの最適化が完了しました。合計 [%s] のディスク容量が解放されました"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1654,6 +1654,8 @@
|
||||||
"266": "Tesseract OCR nie jest zainstalowany lub skonfigurowany, zapoznaj się z Podręcznikiem użytkownika - Sekcja plików zasobów, aby skonfigurować",
|
"266": "Tesseract OCR nie jest zainstalowany lub skonfigurowany, zapoznaj się z Podręcznikiem użytkownika - Sekcja plików zasobów, aby skonfigurować",
|
||||||
"267": "Nienazwana baza danych",
|
"267": "Nienazwana baza danych",
|
||||||
"268": "Uwaga: plik [%s] przekroczył już [%d MB], co może spowodować spadek wydajności",
|
"268": "Uwaga: plik [%s] przekroczył już [%d MB], co może spowodować spadek wydajności",
|
||||||
"269": "Ten blok został już dodany do bazy danych [%s]"
|
"269": "Ten blok został już dodany do bazy danych [%s]",
|
||||||
|
"270": "Optymalizacja indeksu danych, proszę czekać...",
|
||||||
|
"271": "Optymalizacja indeksu danych zakończona, zwolniono [%s] miejsca na dysku"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1654,6 +1654,8 @@
|
||||||
"266": "Tesseract OCR não está instalado ou configurado, consulte o Guia do Usuário - Seção de Arquivos de Recursos para configuração",
|
"266": "Tesseract OCR não está instalado ou configurado, consulte o Guia do Usuário - Seção de Arquivos de Recursos para configuração",
|
||||||
"267": "Banco de dados sem nome",
|
"267": "Banco de dados sem nome",
|
||||||
"268": "Atenção: o arquivo [%s] já excedeu [%d MB], o que pode causar queda de desempenho",
|
"268": "Atenção: o arquivo [%s] já excedeu [%d MB], o que pode causar queda de desempenho",
|
||||||
"269": "Este bloco já foi adicionado ao banco de dados [%s]"
|
"269": "Este bloco já foi adicionado ao banco de dados [%s]",
|
||||||
|
"270": "Otimizando o índice de dados, por favor aguarde...",
|
||||||
|
"271": "Otimização do índice de dados concluída, [%s] de espaço liberado"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1654,6 +1654,8 @@
|
||||||
"266": "Tesseract OCR не установлен или не настроен, пожалуйста, обратитесь к Руководству пользователя - Раздел ресурсов для настройки",
|
"266": "Tesseract OCR не установлен или не настроен, пожалуйста, обратитесь к Руководству пользователя - Раздел ресурсов для настройки",
|
||||||
"267": "База данных не названа",
|
"267": "База данных не названа",
|
||||||
"268": "Обратите внимание, что файл [%s] уже превышает [%d МБ], это может привести к снижению производительности",
|
"268": "Обратите внимание, что файл [%s] уже превышает [%d МБ], это может привести к снижению производительности",
|
||||||
"269": "Этот блок уже добавлен в базу данных [%s]"
|
"269": "Этот блок уже добавлен в базу данных [%s]",
|
||||||
|
"270": "Оптимизация индекса данных, пожалуйста, подождите...",
|
||||||
|
"271": "Оптимизация индекса данных завершена, освобождено [%s] дискового пространства"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1654,6 +1654,8 @@
|
||||||
"266": "Tesseract OCR 未安裝或未配置,請參考 用戶指南-資料文件 章節進行配置",
|
"266": "Tesseract OCR 未安裝或未配置,請參考 用戶指南-資料文件 章節進行配置",
|
||||||
"267": "未命名資料庫",
|
"267": "未命名資料庫",
|
||||||
"268": "請注意該檔案 [%s] 已經超過 [%d MB],可能會導致效能下降",
|
"268": "請注意該檔案 [%s] 已經超過 [%d MB],可能會導致效能下降",
|
||||||
"269": "該塊已經添加到資料庫 [%s] 中"
|
"269": "該塊已經添加到資料庫 [%s] 中",
|
||||||
|
"270": "正在優化資料索引,請稍等...",
|
||||||
|
"271": "資料索引優化完畢,共釋放 [%s] 磁碟空間"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1654,6 +1654,8 @@
|
||||||
"266": "Tesseract OCR 未安装或未配置,请参考 用户指南-资源文件 章节进行配置",
|
"266": "Tesseract OCR 未安装或未配置,请参考 用户指南-资源文件 章节进行配置",
|
||||||
"267": "未命名数据库",
|
"267": "未命名数据库",
|
||||||
"268": "请注意该文件 [%s] 已经超过 [%d MB],可能会导致性能下降",
|
"268": "请注意该文件 [%s] 已经超过 [%d MB],可能会导致性能下降",
|
||||||
"269": "该块已经添加到数据库 [%s] 中"
|
"269": "该块已经添加到数据库 [%s] 中",
|
||||||
|
"270": "正在优化数据索引,请稍等...",
|
||||||
|
"271": "数据索引优化完毕,共释放 [%s] 磁盘空间"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -664,7 +664,46 @@ func normalizeTree(tree *parse.Tree) (yfmRootID, yfmTitle, yfmUpdated string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func VacuumDataIndex() {
|
func VacuumDataIndex() {
|
||||||
|
util.PushEndlessProgress(Conf.language(270))
|
||||||
|
defer util.PushClearProgress()
|
||||||
|
|
||||||
|
var oldsyDbSize, newSyDbSize, oldHistoryDbSize, newHistoryDbSize, oldAssetContentDbSize, newAssetContentDbSize int64
|
||||||
|
info, _ := os.Stat(util.DBPath)
|
||||||
|
if nil != info {
|
||||||
|
oldsyDbSize = info.Size()
|
||||||
|
}
|
||||||
|
info, _ = os.Stat(util.HistoryDBPath)
|
||||||
|
if nil != info {
|
||||||
|
oldHistoryDbSize = info.Size()
|
||||||
|
}
|
||||||
|
info, _ = os.Stat(util.AssetContentDBPath)
|
||||||
|
if nil != info {
|
||||||
|
oldAssetContentDbSize = info.Size()
|
||||||
|
}
|
||||||
|
|
||||||
|
sql.Vacuum()
|
||||||
|
|
||||||
|
info, _ = os.Stat(util.DBPath)
|
||||||
|
if nil != info {
|
||||||
|
newSyDbSize = info.Size()
|
||||||
|
}
|
||||||
|
info, _ = os.Stat(util.HistoryDBPath)
|
||||||
|
if nil != info {
|
||||||
|
newHistoryDbSize = info.Size()
|
||||||
|
}
|
||||||
|
info, _ = os.Stat(util.AssetContentDBPath)
|
||||||
|
if nil != info {
|
||||||
|
newAssetContentDbSize = info.Size()
|
||||||
|
}
|
||||||
|
|
||||||
|
logging.LogInfof("vacuum database [siyuan.db: %s -> %s, history.db: %s -> %s, asset_content.db: %s -> %s]",
|
||||||
|
humanize.BytesCustomCeil(uint64(oldsyDbSize), 2), humanize.BytesCustomCeil(uint64(newSyDbSize), 2),
|
||||||
|
humanize.BytesCustomCeil(uint64(oldHistoryDbSize), 2), humanize.BytesCustomCeil(uint64(newHistoryDbSize), 2),
|
||||||
|
humanize.BytesCustomCeil(uint64(oldAssetContentDbSize), 2), humanize.BytesCustomCeil(uint64(newAssetContentDbSize), 2))
|
||||||
|
|
||||||
|
releaseSize := (oldsyDbSize - newSyDbSize) + (oldHistoryDbSize - newHistoryDbSize) + (oldAssetContentDbSize - newAssetContentDbSize)
|
||||||
|
msg := fmt.Sprintf(Conf.language(271), humanize.BytesCustomCeil(uint64(releaseSize), 2))
|
||||||
|
util.PushMsg(msg, 7000)
|
||||||
}
|
}
|
||||||
|
|
||||||
func FullReindex() {
|
func FullReindex() {
|
||||||
|
|
|
@ -1533,3 +1533,22 @@ func SQLTemplateFuncs(templateFuncMap *template.FuncMap) {
|
||||||
return
|
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
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue