Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:zap: Improve database view performance https://github.com/siyuan-note/siyuan/issues/17830

Daniel99eb811b8682
diff --git a/kernel/sql/database.go b/kernel/sql/database.go
index 7cbe734a1a..7dd4e46bc0 100644
--- a/kernel/sql/database.go
+++ b/kernel/sql/database.go
@@ -268,9 +268,9 @@ func initDBConnection() {
util.LogDatabaseSize(util.DBPath)
dsn := util.DBPath + "?_journal_mode=WAL" +
"&_synchronous=OFF" +
- "&_mmap_size=2684354560" +
+ "&_mmap_size=4294967296" +
"&_secure_delete=OFF" +
- "&_cache_size=-20480" +
+ "&_cache_size=-128000" +
"&_page_size=32768" +
"&_busy_timeout=7000" +
"&_ignore_check_constraints=ON" +
@@ -320,9 +320,9 @@ func initHistoryDBConnection() {
util.LogDatabaseSize(util.HistoryDBPath)
dsn := util.HistoryDBPath + "?_journal_mode=WAL" +
"&_synchronous=OFF" +
- "&_mmap_size=2684354560" +
+ "&_mmap_size=4294967296" +
"&_secure_delete=OFF" +
- "&_cache_size=-20480" +
+ "&_cache_size=-128000" +
"&_page_size=32768" +
"&_busy_timeout=7000" +
"&_ignore_check_constraints=ON" +
@@ -394,9 +394,9 @@ func initAssetContentDBConnection() {
util.LogDatabaseSize(util.AssetContentDBPath)
dsn := util.AssetContentDBPath + "?_journal_mode=WAL" +
"&_synchronous=OFF" +
- "&_mmap_size=2684354560" +
+ "&_mmap_size=4294967296" +
"&_secure_delete=OFF" +
- "&_cache_size=-20480" +
+ "&_cache_size=-128000" +
"&_page_size=32768" +
"&_busy_timeout=7000" +
"&_ignore_check_constraints=ON" +
diff --git a/kernel/treenode/blocktree.go b/kernel/treenode/blocktree.go
index 88367fb8d3..1f34266cbc 100644
--- a/kernel/treenode/blocktree.go
+++ b/kernel/treenode/blocktree.go
@@ -98,9 +98,9 @@ func initDBConnection() {
util.LogDatabaseSize(util.BlockTreeDBPath)
dsn := util.BlockTreeDBPath + "?_journal_mode=WAL" +
"&_synchronous=OFF" +
- "&_mmap_size=2684354560" +
+ "&_mmap_size=4294967296" +
"&_secure_delete=OFF" +
- "&_cache_size=-20480" +
+ "&_cache_size=-128000" +
"&_page_size=32768" +
"&_busy_timeout=7000" +
"&_ignore_check_constraints=ON" +