2009年6月10日 星期三

提升SQLite刪除速度

先前在SQLite下使用BeginTransaction,作INSERT的動作的確有效提升速度。今日使用DELETE時,刪除30筆記錄居然花費到4秒鐘的時間,結果處理的方式是在資料庫連線字串加入Synchronous=OFF。如下:
string strConnection = @"Data source=C:\Datebase.db;Synchronous=OFF;";
SQLiteConnection myConnection = new SQLiteConnection(strConnection);

結果速度馬上由4000ms 提升到 1ms,這真是太~神奇了傑克

沒有留言:

張貼留言