Documentation Home
MySQL 8.0 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 46.1Mb
PDF (A4) - 46.1Mb
PDF (RPM) - 41.5Mb
HTML Download (TGZ) - 10.6Mb
HTML Download (Zip) - 10.6Mb
HTML Download (RPM) - 9.1Mb
Man Pages (TGZ) - 220.4Kb
Man Pages (Zip) - 325.8Kb
Info (Gzip) - 4.1Mb
Info (Zip) - 4.1Mb
Excerpts from this Manual

MySQL 8.0 Reference Manual  /  ...  /  Connection Compression Control

4.2.6 Connection Compression Control

Connections to the server can use a compressed protocol that reduces the number of bytes sent over the connection. By default, connections are uncompressed, but can be compressed if the server and the client both support compression.

Compressed connections originate on the client side but affect CPU load on both the client and server sides because both sides perform compression and decompression operations. Because enabling compression decreases performance, its benefits occur primarily when there is low network bandwidth, network transfer time dominates the cost of compression and decompression operations, and result sets are large.

Compression control applies to connections to the server by client programs and by servers participating in master/slave replication. Compression control does not apply to Group Replication connections, X Protocol connections, or connections for FEDERATED tables.

These configuration parameters are available for controlling connection compression:

  • Client programs support a --compress command-line option to specify use of compression for the connection to the server.

  • MySQL Shell supports compression for connections that use classic MySQL protocol. It provides a --compress command-line option, a compression parameter for URI-like string and key-value pair connection specifications, and a defaultCompress configuration option. (These are available as of MySQL Shell 8.0.14.)

  • For programs that use the MySQL C API, enabling the MYSQL_OPT_COMPRESS option for the mysql_options() function specifies use of compression for the connection to the server.

  • For master/server replication, enabling the slave_compressed_protocol system variable specifies use of compression for slave connections to the master.

In each case, when use of compression is specified, the connection uses the zlib compression algorithm if both sides support it, with fallback to an uncompressed connection otherwise.