# aria\_pack

`aria_pack` is a tool for compressing [Aria](https://mariadb.com/docs/server/server-usage/storage-engines/aria) tables. The resulting tables are read-only, and usually about 40% to 70% smaller.

`aria_pack` is run as follows:

```
aria_pack [options] file_name [file_name2...]
```

The file name is the `.MAI` index file. The extension can be omitted, although keeping it permits wildcards, for instance to compress all the files, such as:

```
aria_pack *.MAI
```

`aria_pack` compresses each column separately. This means, when the resulting data is read, only the individual rows and columns required need to be decompressed, allowing for quicker reading.

Once a table has been packed, use [aria\_chk -rq](https://mariadb.com/docs/server/clients-and-utilities/aria-clients-and-utilities/aria_chk) (the quick and recover options) to rebuild its indexes.

## Options

The following variables can be set as command line options to `aria_pack`, or set in the `[ariapack]` section in your [my.cnf](https://mariadb.com/docs/server/server-management/install-and-upgrade-mariadb/configuring-mariadb/configuring-mariadb-with-option-files) file:

| Option                      | Description                                                                                                                       |
| --------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| -b, --backup                | Make a backup of the table as *`table_name`*`.OLD`.                                                                               |
| --character-sets-dir=*name* | Directory where character sets are located.                                                                                       |
| -h, --datadir               | <p>Path for control file (and logs if <code>--logdir</code> is not used).</p><p>This option is available from MariaDB 10.5.3.</p> |
| -#, --debug\[=name]         | Output debug log. Often this is `d:t:o,filename`.                                                                                 |
| -?, --help                  | Display help and exit.                                                                                                            |
| -f, --force                 | Force packing of table even if it gets bigger or if a temporary file exists.                                                      |
| --ignore-control-file       | <p>Ignore the control file.</p><p>This option is available from MariaDB 10.5.3.</p>                                               |
| -j, --join=*name*           | Join all given tables into *name*. All tables must have identical layouts.                                                        |
| --require-control-file      | <p>Abort if the tool cannot find the control file.</p><p>This option is available from MariaDB 10.5.3.</p>                        |
| -s, --silent                | Only write output when an error occurs.                                                                                           |
| -t, --test                  | Don't pack table, only test packing it.                                                                                           |
| -T, --tmpdir=name           | Use temporary directory to store temporary table.                                                                                 |
| -v, --verbose               | Write info about progress and packing result. Use multiple `-v` options for more verbosity.                                       |
| -V, --version               | Output version information and exit.                                                                                              |
| -w, --wait                  | Wait and retry if table is in use.                                                                                                |

## Unpacking

To unpack a table compressed with aria\_pack, use the [aria\_chk -u](https://mariadb.com/docs/server/clients-and-utilities/aria-clients-and-utilities/aria_chk) option.

## Example

```
> aria_pack /my/data/test/posts
Compressing /my/data/test/posts.MAD: (1690 records)
- Calculating statistics
- Compressing file
37.71%     
> aria_chk -rq --ignore-control-file /my/data/test/posts
- check record delete-chain
- recovering (with keycache) Aria-table '/my/data/test/posts'
Data records: 1690
State updated
```

## See Also

* [FLUSH TABLES FOR EXPORT](https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/flush-commands/flush-tables-for-export)
* [myisamchk](https://mariadb.com/docs/server/clients-and-utilities/myisam-clients-and-utilities/myisamchk)

<sub>*This page is licensed: CC BY-SA / Gnu FDL*</sub>

{% @marketo/form formId="4316" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mariadb.com/docs/server/clients-and-utilities/aria-clients-and-utilities/aria_pack.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
