Documents Compression


  • The Documents Compression feature uses the Zstd compression algorithm to continuously create a more efficient data model with better compression ratios.

  • Go to Settings > Documents Compression to configure compression for a particular database.

    • Revisions are compressed by default.
    • Compress all collections or specific collections can be selected for compression in this view.
  • Compression will be applied to:

    • Newly created documents
    • Existing documents when they are modified and saved

Compressing all existing documents

Only new or modified documents from selected collections will be compressed.
To compress all existing documents without modifying them,
use CompactDatabaseOperation after configuring which collections to compress.


Configure Documents Compression

RavendDB will compress documents in selected collections or in all collections when storing those documents.
The compression will be applied to:

  • Newly created documents
  • Existing documents that are modified and saved

  • If opened just for reading, existing documents will not be compressed .

    • If you also want to compress existing documents without editing them, after configuring the collections to compress, you can use the CompactDatabaseOperation. While removing empty gaps which occupy space in your database, this operation will also trigger compression on collections that were configured.
      • Compaction can also be done via the studio Database Storage Report view.
      • Note: Compression and compaction are two different methods.
        Compression reduces the amount of storage that data uses,
        while compaction removes empty gaps that still occupy space after deletes.
  • Compression is configured in the Database Record.

Document Compression Configuration

Document Compression Configuration

  1. Select Collection(s)
    Select the collections on which to activate compression or select
    • Compress all collections
      Compress All Collections
      Toggle to compress new or modified documents in all collections in this particular database.
  2. Collections Selected
    List of selected collections (seen if "Compress all collections" is toggled off).
  3. Compress Revisions
    Toggle whether to activate compression for all revisions of all collections.
  4. Save
    Save and apply configuration.

Database Storage Report

The database storage report displays detailed information about the database's physical storage.
Go to this page (Stats > Storage Report) to see the effect of compression and compaction.
(Refresh the page to see the changes.)

sampleDB Storage Report

sampleDB Storage Report

  1. Database Component
    • The size of each rectangle is proportional to its storage size.
    • Click any rectangle to view its subdirectories' details.
    • To see storage details, hover over a section or see the detailed list below.
  2. Compact Database
    • Click to compact the database which removes empty gaps that occupy space in your database.
    • All documents will be compressed in any collection where compression is configured when using the CompactDatabaseOperation.
    • Note: During this asynchronous operation the database will be offline.