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.
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.
The maximum string or BLOB length can be lowered at run-time using the sqlite3_limit(db,SQLITE_LIMIT_LENGTH,size) interface. The SQLITE_MAX_COLUMN compile-time parameter is used to set an upper bound on: The number of columns in a table. The number of columns in an index.
SQLite's scalability is limited and only appropriate for smaller databases. Since the platform does not have any user management facility, it is not suitable for multiple user access. For larger files, the memory requirement singificantly increases for SQLite DB.
The VACUUM command works by copying the contents of the database into a temporary database file and then overwriting the original with the contents of the temporary file. When overwriting the original, a rollback journal or write-ahead log WAL file is used just as it would be for any other database transaction.
You could try using VACUUM on your database. See the SQLite doc here : http://www.sqlite.org/lang_vacuum.html
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.
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