5.5. POST /db/_compact

MethodPOST /db/_compact
Request None
Response JSON success statement
Admin Privileges Requiredno
Return Codes
202 Compaction request has been accepted
404 The requested content could not be found. The returned content will include further information, as a JSON object, if available.

Request compaction of the specified database. Compaction compresses the disk database file by performing the following operations:

Compaction can only be requested on an individual database; you cannot compact all the databases for a CouchDB instance. The compaction process runs as a background process.

You can determine if the compaction process is operating on a database by obtaining the database meta information, the compact_running value of the returned database structure will be set to true. See Section 5.1, “GET /db .

You can also obtain a list of running processes to determine whether compaction is currently running. See Section 9.2, “GET /_active_tasks.