# `VERSION::6.6.0` `MPP` Exchange Data Compression

__*6.6 or 6.5 feature?*__

+ `MPP` exchange data compression is controlled by two TiDB system variables
  + **`mpp_version`**: 0, 1 (from v6.6.0, data compression enabled), 2 (default from v7.3.0, better error messages provided)
  + **`mpp_exchange_compression_mode`**
    + `UNSPECIFIED`: TiDB automatically selects the compression mode, currently defaulting to FAST.
    + `NONE`: No data compression is applied.
    + `FAST`: Provides a good balance between performance and compression ratio.
    + `HIGH_COMPRESSION`: Offers a higher compression ratio at the cost of increased CPU usage.

```
+--------------------------------+------------+--------------+---------------+--------------------------------------------------------------------+
| id                             | estRows    | task         | access object | operator info                                                      |
+--------------------------------+------------+--------------+---------------+--------------------------------------------------------------------+
| TableReader_36                 | 2825288.58 | root         |               | MppVersion: 1, data:ExchangeSender_35                              |
| └─ExchangeSender_35            | 2825288.58 | mpp[tiflash] |               | ExchangeType: PassThrough                                          |
|  └─HashJoin_8                  | 2825288.58 | mpp[tiflash] |               | inner join, equal:[eq(employees.emp.emp_no, employees.sal.emp_no)] |
|   ├─ExchangeReceiver_33(Build) | 300024.00  | mpp[tiflash] |               |                                                                    |
|   │ └─ExchangeSender_32        | 300024.00  | mpp[tiflash] |               | ExchangeType: Broadcast, ~!@Compression: FAST@!~                         |
...
```
------------------------------------------------------------------------------
In the previous slide, the operator info from the execution plan shows `ExchangeType: Broadcast, Compression: FAST`. This indicates that the `ExchangeSender_32` uses the FAST compression method when sending data to `ExchangeReceiver_33(Build)`. This feature reduces I/O traffic during data exchanges between TiFlash nodes. However, high compression ratios can increase CPU load on TiFlash nodes.

Starting from TiDB v6.6, FAST compression is the default method. The compression method can be configured using the `mpp_exchange_compression_mode` system variable, or data compression can be disabled. The available options are:

- `UNSPECIFIED`: TiDB automatically selects the compression mode, currently defaulting to FAST.
- `NONE`: No data compression is applied.
- `FAST`: Provides a good balance between performance and compression ratio.
- `HIGH_COMPRESSION`: Offers a higher compression ratio at the cost of increased CPU usage.

Note: The `mpp_exchange_compression_mode` setting is effective only when `mpp_version` is set to 1. By default, `mpp_version` is `UNSPECIFIED`, which means TiDB will automatically use version 1.