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.
-
Go to Stats > Storage Report to see the contents and size of your database storage, and to compact the database.
-
In this page:
Configure Documents Compression
RavenDB 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.
-
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.
-
Compression is configured in the Database Record.

Document Compression Configuration
-
Select Collection(s)
Select the collections on which to activate compression or select- Compress all collections
Toggle to compress new or modified documents in all collections in this particular database.
- Compress all collections
- Collections Selected
List of selected collections (seen if "Compress all collections" is toggled off). - Compress Revisions
Toggle whether to activate compression for all revisions of all collections. - 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
-
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.
-
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.