sprocket12
sprocket12

Reputation: 5488

how to compress sqlite database

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.

Upvotes: 12

Views: 26263

Answers (2)

Dennis R
Dennis R

Reputation: 619

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.

Upvotes: 3

SolarBear
SolarBear

Reputation: 4629

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

Upvotes: 4

Related Questions