Compacting data files

Database and view compaction helps to reclaim disk space and reduce fragmentation.

The data files in which information is stored in a persistent state for a Couchbase bucket are written to and updated as information is appended, updated and deleted. This process eventually leads to gaps within the data file (particularly when data is deleted) which can be reclaimed using a process called compaction.

The index files that are created each time a view is built are also written in a sequential format. Updated index information is appended to the file as updates to the stored information is indexed.

In both these cases, frequent compaction of the files on disk can help to reclaim disk space and reduce fragmentation.