问题
I am a bit new to android and I am working on a project which used to have 40 MBs of sqlite database. Now I wanna put blob data of sqlite in raw folder, so my database is now less than 1 MB. The problem is that in the database path(data/data/package name/databases) the db file size is still the same as the past(my cellphone is rooted so I can check it after each debugging). In DB browser we can use compact database in order to reduce the db size after dropping some tables. now what can I do ? any help would be appreciated. tnx in advance.
回答1:
The VACUUM command may be what you want.
This will copy the data to a temporary database and then use this to overwrite the original.
You would use something along the lines of:-
db.execSQL("VACUUM");
Note the warnings about compatibility in the following:-
SQL As Understood By SQLite - VACUUM
来源:https://stackoverflow.com/questions/46694737/updating-and-compacting-sqlite-database-in-android