# Compacting a RavenDB database

- Link: https://saguiitay.com/compacting-a-ravendb-database/
- Published: 2014-09-04T20:07:00+03:00
- Author: Itay

One of my [RavenDB](https://ravendb.net) databases grew to an unrealistic size –
36GB when it contains around 500,000 documents which are mostly small. After some
back-and-forth with the RavenDB support team, I was suggested to compact the database.
Sounds easy, if you know what you’re doing, since documentation on that is … let’s
say lacking… Here’s what you do, for my own future reference…

![RavenDB Logo](https://i0.wp.com/saguiitay.com/wp-content/uploads/ravendb-logo.
png?resize=550%2C191&ssl=1 "Compacting a RavenDB database 1")

Using [cUrl](https://curl.se/), do a POST request to `http://servername/admin/compact?
database=DatabaseName`

Here’s a sample call:

    ```notranslate
    cUrl -F 'database=UsersDatabase' http://localhost:8080/admin/compact?database=UsersDatabase
    ```

Notice that if you’re using any form of authentication, you need to provide that
too. Here’s how it’s done for NTLM Authentication:

    ```notranslate
    cUrl --ntlm --user username:password -F 'database=UsersDatabase' http://localhost:8080/admin/compact?database=UsersDatabase
    ```

**NOTICE: Your database will be off-line during the compact process and won’t be
accessible.**

### _Related_
