Android Question How to avoid OS killing app or process when running large vacuum?

RB Smissaert

Well-Known Member
Licensed User
Longtime User
When running a large (large SQLite DB file) vacuum I have problems with the Android OS killing the app or perhaps just the vacuum process.
I say "perhaps just the vacuum process" as sometimes the app is not killed but the vacuum has done nothing, meaning the size of the DB file has not reduced
and also running:
pragma freelist_count
gives the same (non-zero) number before and after the vacuum.
There is no error message at all, so either the app or the vacuum process are killed silently.

As mentioned in a previous thread (getting too long now) regarding this I have a solution by making use of this SQLCipher function:
SELECT sqlcipher_export
but I am still interested to make the vacuum work.

RBS
 

RB Smissaert

Well-Known Member
Licensed User
Longtime User
This could also be tested using @agraham's threading library. This may be one of the cases where it would be necessary to use (until a permanent fix is offered). Just beware of interacting with code that runs on the main thread. Look at the included example on how to properly raise events from the thread.

Link: https://www.b4x.com/android/forum/threads/threading-library.6775/#content
That threading library looks complex (and using threads seems generally to be "ill-advised") and running a large vacuum is tricky enough as it is so will not go that route.
Running a vacuum has 2 benefits: Reducing the file size and possibly increasing SQL performance speed.
Now the performance increase seems quite small from own experience and also from doing some internet research.
The file reduction is the same with using sqlcipher_export and it runs a lot faster than a vacuum, so I think will for now just leave the idea of vacuuming a large DB.
Still interested though if somebody can tell me they did vacuum a large (and encrypted) SQLCipher SQLite DB successfully.

RBS
 
Upvote 0
Top