Database Compaction

By design, the size of a RavenDB database will continually grow as more data is added to the database. There is no built-in mechanism to automatically reclaim free disk space. If you delete a large number of documents or attachments, you will not see the size of your database decrease and you will still be charged for the amount of disk space that RavenDB is actually using.

In order to work around this constraint, we allow you to compact (think defrag) your RavenDB database at any point in time.  Please Note: Compaction is an offline process that will take longer to complete the larger your database is.  Once it is started it cannot be canceled. It is strongly recommended that you backup your database before beginning this operation. 

To compact a database simply go to the database details page and click on "Compact" under the "Manage Database" heading.  A confirmation window will appear and once confirmed you will be able to select the database instance you wish to compact.  That instance will be placed in offline mode and the compaction will begin.


Have more questions? Submit a request


  • 0
    Phil Jenkins

    When you compact your primary database will your replication database automatically kick in as a replacement so the app does not go offline? or will we need to point the app to the replication in order to ensure no downtime.

Please sign in to leave a comment.