Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Transparent SQLite Data Compression

I am looking for an existing solution for transparent SQLite 3 zlib compression using a custom VFS implementation and a custom IO methods implementation.

Is anyone aware of an existing project that already does that, or will I have to roll my own? I vaguely remember seeing something similar a year ago, but can't find it anymore.

like image 653
Alex B Avatar asked Nov 29 '09 22:11

Alex B


People also ask

Can you compress SQLite database?

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.

How big is too big for SQLite?

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.

How do you vacuum SQLite?

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.

Is SQLite slower?

The SQLite3 database will just return the single record that you wanted directly. So your "sequential file" is 50,000 times slower than SQLite3 at retrieving data.


2 Answers

The Compressed and Encrypted Read-Only Database (CEROD) SQLite extension does compression, and is available from the authors of SQLite. It is a commercial add-on.

like image 189
Doug Currie Avatar answered Oct 23 '22 19:10

Doug Currie


You could also use a compressed filesystem via FUSE, such as FuseCompress or compFUSEd, which transparently compresses the sqlite file using zlib, lzo, or bzip2.

Edit: There is also a separate solution that you can load as an extension, sqlitecompress.

like image 34
John Paulett Avatar answered Oct 23 '22 19:10

John Paulett