SQLCipher Database size keeps on growing even after deleting records from table


#1

My Android application uses SQLCipher for a database encryption, as per my project requirement I need to store Bitmap String in my local database which needs to get removed from the database once uploaded to the server successfully. But here I met with a very weird issue with the SQLCipher i.e. even after deleting all the image strings from table my app’s database size doesn’t decrease rather it got increased. For instance my db’s initial size was 45 KB With 30 image strings in table size became 2.91 MB And, after deleting 30 images from table size got increased to 3.04 MB

But, when I did the same case with normal SQLite database i.e. without SQLCipher encryption, I got the expected results i.e. db size 2.91 got reduced to 50 KB after deleting the images from the table.

Please assist…


#2

Hello @111

You may want to look into performing a vacuum of the database file. Unless you have auto_vacuum enabled, deleting data from the database will leave empty space as free database pages, maintaining a similar size on disk. If that resolves your issue, you might also consider using auto_vacuum feature. Please let us know if this resolves the issue for you.


#3

@111 Did doing a vacuum on the database work? :slight_smile: