Database compression

A Store database can be compressed and the data is dynamically decompressed as required. A compressed database is read-only.

A Store database can be compressed.

Once compressed, a Store database is read-only, but otherwise operates as normal and is opened in exactly the same way as an uncompressed database; data is dynamically decompressed as required.

The memory required to decompress data as it is read, depends on the length of the streams in the database store, but is typically just a few kilobytes. A compressed database is not noticably slower than the equivalent uncompressed database, especially on slower media, such as CF-card.

The RDbStoreDatabase class provides the functions CompressL() and DecompressL() to convert a Store database to compressed form and vice-versa.

Note that:

  • encrypted databases cannot be compressed

  • index data is not compressed as the presence of indexes reduces the effective compression ratio

  • compression code on the emulator is more aggressive than that on ARM builds and can achieve better compression ratios; the resulting files are about 5% smaller at the expense of doing two or three times as much work

  • compressing or decompressing a database can require a significant amount of memory.

When a file-store database is constructed using the RDbNamedDatabase interface, there is no access to the underlying store