# Compact the Index

The `DRECOMPACT` operation is a maintenance action used to clean up and optimize the IDOL index (similar to a de-fragmentation process). There are two main scenarios where you would typically run a `DRECOMPACT`:

- The index contains many deleted documents.

- The `DREREPLACE` operation has been used to make large-scale modifications to documents.

In the first case, the `DRECOMPACT` operation reclaims all disk and memory space consumed by deleted documents (delete operations just flag a document as inaccessible until you run a compaction). It also removes terms from the index that no longer appear in any document.

TIP: The `GetStatus` action response gives the number of document sections, and the number of committed documents. These numbers give an indication of the number of deleted documents that have not yet been compacted. You might want to consider compacting when the number of committed documents gets large compared to the total number of document sections, for example, when there are 20% more committed documents.

In the second case the modification of documents can result in wasted space in the nodetable index, and a `DRECOMPACT` can reclaim this space. You can restrict the `DRECOMPACT` index action to run just the nodetable part, which reduces the amount of time the action takes, while still performing most of the useful operations.

You can run the full version of the `DRECOMPACT` index action manually, or you can schedule it to run on a regular basis. The scheduled approach is most useful in one of the following cases:

- you have a good idea of the rate at which documents are deleted (for example, if they are deleted as a consequence of timed expiry).

- you know there is a period of inactivity (for example, overnight or at the weekends) where few users will be affected by the compaction operation.

  NOTE: The index is still searchable during the compact operation. The compaction operation is largely I/O intensive.

There are scenarios where it is easier to set up an architecture such that compacting the index in a particular server becomes unnecessary.

A setup might use seven IDOL Server indexes to store the last seven days worth of content (each server indexing one day), in which case you can just wipe the server for today and start again, rather than deleting all the data and running a `DRECOMPACT` operation.

TIP: As an alternative to running the `DRECOMPACT` index action, you can use the Compact feature on the Service Control tab of the Console page in the Control section of IDOL Admin.

_FT_HTML5_bannerTitle.htm