Android storage issue

I have an application that stores data in a SQLite database, when the application has just been installed, it uses 8 kilobytes of data, and when I start inserting data, obviously, the size increases. Strange, when I start cleaning my database tables, I completely empty the database, but I will never restore the first 8 KB of data, but much more, and in some cases more than 100 kb, where does this data come from?

+6
source share
1 answer

The database is not like a file system, so when you delete data from the database, you do not restore the space that you previously used. The database driver will prefer to keep the old allocated space.

You can compress your database, which will restore this space by executing the SQLite VACUUM command manually.

It may be possible to enable auto_vacuum mode, but this must be done before creating the database.

+11
source

Source: https://habr.com/ru/post/887821/


All Articles