From 7690683366bbc502429b892d8ed6163497cc9c92 Mon Sep 17 00:00:00 2001 From: Ben Gotow Date: Tue, 1 Sep 2015 13:35:23 -0700 Subject: [PATCH] fix(db): Use recommended page-size, cache size. Allow 80MB in RAM cache --- src/flux/stores/database-setup-query-builder.coffee | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/flux/stores/database-setup-query-builder.coffee b/src/flux/stores/database-setup-query-builder.coffee index fc80d6e8d..e857a70fa 100644 --- a/src/flux/stores/database-setup-query-builder.coffee +++ b/src/flux/stores/database-setup-query-builder.coffee @@ -16,7 +16,12 @@ class DatabaseSetupQueryBuilder # https://www.sqlite.org/wal.html # WAL provides more concurrency as readers do not block writers and a writer # does not block readers. Reading and writing can proceed concurrently. - queries.push "PRAGMA journal_mode=WAL;" + queries.push "PRAGMA journal_mode = WAL;" + # https://www.sqlite.org/intern-v-extern-blob.html + # A database page size of 8192 or 16384 gives the best performance for large BLOB I/O. + queries.push "PRAGMA main.page_size = 8192;" + queries.push "PRAGMA main.cache_size = 20000;" + queries.push "PRAGMA main.synchronous = NORMAL;" # Add table for storing generic JSON blobs queries.push("CREATE TABLE IF NOT EXISTS `JSONObject` (key TEXT PRIMARY KEY, data BLOB)")