sqlx icon indicating copy to clipboard operation
sqlx copied to clipboard

feat(mysql): add compression

Open izebit opened this issue 2 months ago • 0 comments

Does your PR solve an issue?

Fixes #186.

This PR adds support for traffic compression in MySQL & MariaDB. Data can now be compressed using either zstd or zlib, when the server supports the selected algorithm. MariaDB supports zstd only.

Compression can be enabled by adding a parameter to the connection URL:

compression=<algorithm>:<level>

For example:

compression=zstd:2
compression=zlib:3

Or programmatically:

use sqlx_mysql::{Compression, CompressionConfig, MySqlConnectOptions};

let options = MySqlConnectOptions::new()
    .compression(Compression::Zlib.fast());

‼️ To enable this functionality, add the mysql-compression feature flag.

Is this a breaking change?

No. This is not a breaking change. It extends the existing MySQL connection settings by introducing a new optional compression parameter.

izebit avatar Nov 21 '25 20:11 izebit