From 8bf916ca030b7ce0c28d7648112aecc531420948 Mon Sep 17 00:00:00 2001 From: scorpio810 Date: Fri, 7 Feb 2014 07:04:27 +0000 Subject: [PATCH] Optimizes cache_db_ for faster git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2817 bfdf4180-ca20-0410-9c96-a3a8aa849046 --- sources/elementscollectioncache.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sources/elementscollectioncache.cpp b/sources/elementscollectioncache.cpp index b83550a80..c2a1119e8 100644 --- a/sources/elementscollectioncache.cpp +++ b/sources/elementscollectioncache.cpp @@ -39,10 +39,12 @@ ElementsCollectionCache::ElementsCollectionCache(const QString &database_path, Q if (!cache_db_.open()) { qDebug() << "Unable to open the SQLite database " << database_path << " as " << connection_name << ": " << cache_db_.lastError(); } else { - cache_db_.exec("PRAGMA temp_store=MEMORY"); + cache_db_.exec("PRAGMA temp_store = MEMORY"); cache_db_.exec("PRAGMA journal_mode = MEMORY"); - cache_db_.exec("PRAGMA synchronous=OFF"); - cache_db_.exec("PRAGMA cache_size=10000"); + cache_db_.exec("PRAGMA page_size = 4096"); + cache_db_.exec("PRAGMA cache_size = 16384"); + cache_db_.exec("PRAGMA locking_mode = EXCLUSIVE"); + cache_db_.exec("PRAGMA synchronous = OFF"); /// @todo the tables could already exist, handle that case. cache_db_.exec("CREATE TABLE names (path VARCHAR(512) NOT NULL, locale VARCHAR(2) NOT NULL, mtime DATETIME NOT NULL, name VARCHAR(128), PRIMARY KEY(path, locale));"); cache_db_.exec("CREATE TABLE pixmaps (path VARCHAR(512) NOT NULL UNIQUE, mtime DATETIME NOT NULL, pixmap BLOB, PRIMARY KEY(path), FOREIGN KEY(path) REFERENCES names (path) ON DELETE CASCADE);");