sqlite添加参数_sync=OFF

This commit is contained in:
GoEdgeLab
2022-03-14 11:08:02 +08:00
parent 5279877cd2
commit 9a6a491817
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -82,7 +82,7 @@ func (this *FileList) Init() error {
} }
var dbPath = dir + "/index.db" var dbPath = dir + "/index.db"
remotelogs.Println("CACHE", "loading database '"+dbPath+"'") remotelogs.Println("CACHE", "loading database '"+dbPath+"'")
db, err := sql.Open("sqlite3", "file:"+dbPath+"?cache=shared&mode=rwc&_journal_mode=WAL&_cache_size=16000") db, err := sql.Open("sqlite3", "file:"+dbPath+"?cache=shared&mode=rwc&_journal_mode=WAL&_sync=OFF&_cache_size=16000")
if err != nil { if err != nil {
return errors.New("open database failed: " + err.Error()) return errors.New("open database failed: " + err.Error())
} }
+1 -1
View File
@@ -51,7 +51,7 @@ func (this *IPListDB) init() error {
remotelogs.Println("CACHE", "create cache dir '"+this.dir+"'") remotelogs.Println("CACHE", "create cache dir '"+this.dir+"'")
} }
db, err := sql.Open("sqlite3", "file:"+this.dir+"/ip_list.db?cache=shared&mode=rwc&_journal_mode=WAL") db, err := sql.Open("sqlite3", "file:"+this.dir+"/ip_list.db?cache=shared&mode=rwc&_journal_mode=WAL&_sync=OFF")
if err != nil { if err != nil {
return err return err
} }
+1 -1
View File
@@ -88,7 +88,7 @@ func (this *Task) Init() error {
remotelogs.Println("METRIC", "create data dir '"+dir+"'") remotelogs.Println("METRIC", "create data dir '"+dir+"'")
} }
db, err := sql.Open("sqlite3", "file:"+dir+"/metric."+strconv.FormatInt(this.item.Id, 10)+".db?cache=shared&mode=rwc&_journal_mode=WAL") db, err := sql.Open("sqlite3", "file:"+dir+"/metric."+strconv.FormatInt(this.item.Id, 10)+".db?cache=shared&mode=rwc&_journal_mode=WAL&_sync=OFF")
if err != nil { if err != nil {
return err return err
} }