There are a few very important guidelines for optimal SQLCipher performance, listed here in rough order of potential impact:
analyze;
command to collect statistics about tables, indices, and stored data to help the query planner make better planning choices for queries.SQLCipher’s enhanced memory security feature is turned off by default as of SQLCipher 4.5.0. If your application is using an older version and deals with large amounts of data (e.g. full table scans, large text values, BLOBS) then it may be desirable to disable the memory security and wiping feature with the following PRAGMA:
PRAGMA cipher_memory_security = OFF;
To diagnose performance problems with specific query statements, it may be helpful to run an explain query plan command against specific queries. The output of the explain query command is described here.
If you are uncertain of what queries are performing poorly, SQLCipher includes a pragma called cipher_profile
that allows for profiling queries and their respective execution time in milliseconds.
SQLCipher Commercial and Enterprise packages are specially optimized and may be up to 3-4x faster than free Community Edition packages. They also include advanced features that can help get the best possible performance out of SQLCipher like:
For more information on performance testing comparisons between SQLCipher and competing encryption providers please see this article.