Sqlite3_enable_shared_cache and sqlite_backup_init slow down execution on iPhone
I have relatively complex sqlite queries running in my iPhone app and some of them are taking too long (more than 15 seconds). There are 430 records in the database. One thing I noticed is that opening a new database connection (which I only do once) and navigating through the query results (with sqlite3_step()
) results in a start sqlite3_backup_init()
and sqlite3_enable_shared_cache()
, which take 4450ms and 3720ms respectively in during the entire trial period. I tried using sqlite3_enable_shared_cache(0);
to disable shared caching before opening a database connection, but that doesn't seem to have any effect.
Does anyone know how to turn them off so I can improve the speed?
a source to share
Well, I suppose this doesn't directly answer the question, but part of the problem was using a cross join instead of a left join. This reduced the request time from roughly 4000ms to 60ms. In addition, the function is backup_init
no longer called and is enable_shared_cache
not rotated.
a source to share