We integrate the SqlCiper SQLite DB into our existing Android project. What we found out that there is some big difference in DB query performance in unencrypted SqlCiper SQLite DB and encrypted SqlCiper SQLite DB. And my app became unbelievably slow. It takes ages to take click actions.
I added implementation 'net.zetetic:android-database-sqlcipher:4.2.0@aar'
Hello @sushil_kumar. I can’t really say what would cause your application to have significant varying times. It may have to do with caching or the types of queries you are using. If you’d like to debug further it might be worthwhile to try using PRAGMA cipher_profile to look for particularly long running queries. Have you tried any of the other easy performance suggestions, like using transactions or adjusting the memory security settings?
One way the performance with SQLCipher differs significantly from the default Android SQLite API is with concurrent database operations. SQLCipher’s Android API has a locking behavior that has been improved in the default API since API 16 (Jelly Bean). More details here: Android API Update
@Jeff_Lockhart - I believe that in this case the OP’s issue was that the procedure used to open a DB connection was repeatedly performing key derivation. This is the number one cause of poor performance with SQLCipher. Many applications using SQLite assume that opening a DB connection is a fast operation, and that is not the case with SQLCipher.
As a result SQLCipher’s locking behavior is not relevant to this user’s issue (or to be honest, the vast majority of the performance problems that people report). We definitely recognize and share your interest in improving locking. We also understand that your application is already optimized enough that concurrently issues are the main performance block. However, for most applications, like the one in this thread, the items in the SQLCipher Performance Optimization FAQ are most appropriate as a first line of investigation.