Optimize sqlite for better performance.
authorPeng Huang <shawn.p.huang@gmail.com>
Mon, 4 Jan 2010 00:25:41 +0000 (08:25 +0800)
committerPeng Huang <shawn.p.huang@gmail.com>
Mon, 4 Jan 2010 00:25:41 +0000 (08:25 +0800)
src/Database.cc

index 39a3b87..a5f78f9 100644 (file)
@@ -92,6 +92,12 @@ Database::init (void)
     /* Using memory for temp store */
     m_sql << "PRAGMA temp_store=MEMORY;\n";
 
+    /* Set journal mode */
+    m_sql << "PRAGMA journal_mode=TRUNCATE;\n";
+
+    /* Set the sync mode */
+    m_sql << "PRAGMA synchronous=NORMAL;\n";
+
     /* Using EXCLUSIVE locking mode on main database
      * for better performance */
     m_sql << "PRAGMA main.locking_mode=EXCLUSIVE;\n";