0

My app's database keeps growing and I want to perform a VACUUM to retrieve some lost space. From what I've read VACUUM does not run if there are other transactions.

My question is: how do I run the command from my SQLiteOpenHelper? is something like db.execSQL("VACUUM") work? But how do I get some sort of progress while doing this so I can block the UI with a loading dialog?

Alin
  • 14,809
  • 40
  • 129
  • 218

1 Answers1

3

You can run VACUUM like any other SQL commands; execSQL() will work.

However, there is not mechanism to track the progress.

And SQLite automatically reuses free pages, so VACUUM is unlikely to help. (It is useful only if you have deleted a large amount of data, and know that you will not insert new data again.)

CL.
  • 173,858
  • 17
  • 217
  • 259