我的问题似乎已经解决了。
当包含大约2500行时,我有一个sqlite数据库。当我执行以下操作时:
ContentValues values = new ContentValues();
values.put(column, 0);
db.update(table, values, null, null);
在完成之前平均花费3秒。
我也试过
db.execSQL("UPDATE table SET column = 0");
更长。
以下是我在PC上执行相同命令时获得的.stat
信息:
sqlite> .stat on
sqlite> UPDATE table SET column = 0;
Memory Used: 10322672 (max 12336272) bytes
Number of Outstanding Allocations: 2229 (max 2529)
Number of Pcache Overflow Bytes: 10237952 (max 10243072) bytes
Number of Scratch Overflow Bytes: 0 (max 0) bytes
Largest Allocation: 797509 bytes
Largest Pcache Allocation: 4248 bytes
Largest Scratch Allocation: 0 bytes
Lookaside Slots Used: 16 (max 56)
Successful lookaside attempts: 155
Lookaside failures due to size: 190
Lookaside failures due to OOM: 0
Pager Heap Usage: 8468392 bytes
Page cache hits: 87018
Page cache misses: 16596
Page cache writes: 13201
Schema Heap Usage: 5088 bytes
Statement Heap/Lookaside Usage: 2656 bytes
Fullscan Steps: 2584
Sort Operations: 0
Autoindex Inserts: 0
Virtual Machine Steps: 67221
任何人都可以帮我找出问题所在以及如何解决问题吗?