Reputation: 1518
databaseInstance.execSQL("PRAGMA auto_vacuum = FULL");
Currently i am using it after creating DB and before creating Tables of DB. I did some transaction with DB and it size with all these data is 34016 Byte and then i delete all these data then ideally DB size should get down but what is happening that :- Data get deleted and size get increase 43232 Byte. What is wrong please help me. Thanks in advance to all.
Upvotes: 1
Views: 1518
Reputation: 180210
The documentation says:
Auto-vacuuming is only possible if the database stores some additional information that allows each database page to be traced backwards to its referrer. Therefore, auto-vacuuming must be turned on before any tables are created. It is not possible to enable or disable auto-vacuum after a table has been created.
This is a little bit misleading. "Before any tables are created" actually should say "before the database is actually created". You should execute it directly after opening the new database, before setting anything else, and before the first transaction is begun.
If you are using SQLiteOpenHelper
, put it into the onConfigure
callback.
Upvotes: 1