# compact

    compact store-name max-time

Compacts the store files for the specified store. Compaction is available for stores of type `file` and `mstore`, but is not available for stores of type `dbstore`.

Since compaction can be a lengthy operation and it blocks other operations, max-time specifies a time limit (in seconds) for the operation. Note that max-time must be a number greater than zero. For `mstore` files, you can optionally specify `nolimit` for the max-time. See below for more information.

For stores of type `file`:

- If truncation is not enabled for the store file, the `compact` command does not reduce the file size. Enable truncation using the `file_truncate` parameter in the stores.conf file. See `stores.conf` for more information.
- We recommend compacting the store files only when the `Used Space` usage is 30% or less (see `show store`).

For stores of type `mstore`:

- The following types of compaction are available:
  - Time-bound compact
      Use max-time to specify a time limit (in seconds) for the compact operation. Time-bound compaction may increase the fragmentation of the store files. This feature is not available by default. Before using it, you need to run the `tibemsdbconvert` tool with option `-version 8.3` on the required `mstore` files. See tibemsdbconvert Tool for more information.
  - No-limit compact
      Enter `nolimit` for max-time. This triggers a full re-write of the store with no time limit. Once started, it is not possible to interrupt the re-write. All other operations (creating new connections, sending and receiving messages, and so forth) are suspended until the store is fully re-written. This can take a very long time for large stores. Using `nolimit` effectively defragments a store file.
- Compaction for `mstores` is not affected by the value of the `mstore_truncate` parameter.

Copyright © Cloud Software Group, Inc. All rights reserved.