11-28-2012 04:45 AM
I am performing some DB transactions in a block, but it is taking more than 2 seconds to complete the transaction. Transactions are as follows:
OPENING DATABASE sqlite
sqlite.beginTransaction();// BEGIN TRANSACTION
sqlite.commitTransaction();// COMMIT TRANSACTION
CLOSING DATABASE sqlite
How can I improve the speed for above DB transactions??
11-28-2012 05:27 AM
The whole operation is taking about 2 seconds to complete. Single operation is taking about 250 ms.
yes, opening and closing is needed. As per App need, I am using synchronized blocks with lock on 1 object and OPENING and CLOSING DATABASE in same synchronized blocks.
I am using this mechanism to avoid concurrent access of database by background threads.
Is there any method to speedup the DB transactions??
11-28-2012 02:22 PM - edited 11-28-2012 02:22 PM
Consider holding a cache in memory and have one thread which will update the DB.
Even if you won't have the all DB in memory you will still be able to reduce DB I/O and improve performance.