As part of refreshing some of the customer records in my sqlite database, I deleted a load of records and then imported some from an imported table. I then deleted the temp table and did a vacuum. The file was around 6mb before vacuuming and then 10mb after vacuuming. I did an integrity check and it seems ok. I did another test and if I don't vacuum, the file size is still about 6mb.
Am I doing something wrong?
(I've been doing the vacuum using a SQLite Manager. When using SQLiteSpy, however, it works properly. So it seems to be a problem with SQLite Manager. Might be of use to someone who has a similar problem)
Try to zip it and use zipinput stream while unpacking your database from assets. Anyway, android will zip your 14mb database when you create your apk anyway (which will be unzipped during install), so I guess your apk will be around 5-6mb in size. Android will zip automatically when creating/exporting apk file?
VACUUM command cleans the main database by copying its contents to a temporary database file and reloading the original database file from the copy. This eliminates free pages, aligns table data to be contiguous, and otherwise cleans up the database file structure.
The SQLite Compressed and Encrypted Read-Only Database (CEROD) Extension is an add-on to the public domain version of SQLite that allows an application to read compressed and encrypted database files in addition to ordinary SQLite database files.
SQLite database files have a maximum size of about 140 TB. On a phone, the size of the storage (a few GB) will limit your database file size, while the memory size will limit how much data you can retrieve from a query. Furthermore, Android cursors have a limit of 1 MB for the results.
It's a bug with SQLite Manager. See my comments in the original post. Works when using another tool like SQLiteSpy.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With