From cb156e1903ee5be8d82674950b10521b058053a2 Mon Sep 17 00:00:00 2001 From: Gani Georgiev Date: Mon, 24 Jul 2023 10:35:42 +0300 Subject: [PATCH] increased the default sqlite cache_size to 16mb --- core/db_cgo.go | 1 + core/db_nocgo.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/core/db_cgo.go b/core/db_cgo.go index 4165ac24..25d46083 100644 --- a/core/db_cgo.go +++ b/core/db_cgo.go @@ -29,6 +29,7 @@ func init() { PRAGMA synchronous = NORMAL; PRAGMA foreign_keys = ON; PRAGMA temp_store = MEMORY; + PRAGMA cache_size = -16000; `, nil) return err diff --git a/core/db_nocgo.go b/core/db_nocgo.go index 9135db3c..98fe8c3a 100644 --- a/core/db_nocgo.go +++ b/core/db_nocgo.go @@ -11,7 +11,7 @@ func connectDB(dbPath string) (*dbx.DB, error) { // Note: the busy_timeout pragma must be first because // the connection needs to be set to block on busy before WAL mode // is set in case it hasn't been already set by another connection. - pragmas := "?_pragma=busy_timeout(10000)&_pragma=journal_mode(WAL)&_pragma=journal_size_limit(200000000)&_pragma=synchronous(NORMAL)&_pragma=foreign_keys(ON)&_pragma=temp_store(MEMORY)" + pragmas := "?_pragma=busy_timeout(10000)&_pragma=journal_mode(WAL)&_pragma=journal_size_limit(200000000)&_pragma=synchronous(NORMAL)&_pragma=foreign_keys(ON)&_pragma=temp_store(MEMORY)&_pragma=cache_size(-16000)" db, err := dbx.Open("sqlite", dbPath+pragmas) if err != nil {