how to compress sqlite database

15,958

Solution 1

You could try using VACUUM on your database. See the SQLite doc here : http://www.sqlite.org/lang_vacuum.html

Solution 2

CEVFS: Compression & Encryption VFS for SQLite 3

CEVFS is a SQLite Virtual File System which uses its own pager and is inserted between the pager used by the b-tree (herein referred to as the upper pager) and the OS interface. This allows it to intercept the read/write operations to the database and seamlessly compress/decompress and encrypt/decrypt the data.

Share:
15,958
sprocket12
Author by

sprocket12

Updated on June 24, 2022

Comments

  • sprocket12
    sprocket12 almost 2 years

    I have a sqlite database in my offline app that has reached 32mb. Its created from asset files on launch which are 6mb in size.

    Is there any built in compression function that permenantly causes the database to become smaller, I dont mind the performance hit while reading. It would then use less of the users phone memory.

    Any ideas?

    The DB has two tables which are mostly long text fields. The size is the end result of 7000+ inserts upon first application launch.