2011-05-03 41 views

回答

1

嘗試在更新之前執行PRAGMA synchronous = OFF

+0

你把這個放在哪裏? – barcodereader 2011-05-03 02:15:30

+0

SQLite android 2.1 – barcodereader 2011-05-03 02:15:57

+0

我也看到有人提到編譯SQLite時用SQLITE_NO_SYNC定義重新編譯sqlite,並且速度有很大的提高。任何意見。 http://osdir.com/ml/sqlite-users/2010-08/msg00630.html – barcodereader 2011-05-03 03:00:50

3

如果您尚未將整個操作包裝在事務中。你的代碼應該是這樣的:

db.beginTransaction(); 
try { 
    // insert your data here 
    db.setTransactionSuccessful(); 
} finally { 
    db.endTransaction(); 
} 
+0

好的提示。我添加了一個交易,以我緩慢的保存方法之一爲基礎,並將其改進了10倍。「PRAGMA synchronous = OFF」僅將其提高了2倍。 – Henry 2012-10-04 20:51:30