<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h3 class="title">
      <a name="connection-compression-control">
      </a>
      6.2.8 Connection Compression Control
     </h3>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045322304688">
  </a>
  <a class="indexterm" name="idm46045322303200">
  </a>
  <p>
   Connections to the server can use compression on the traffic
      between client and server to reduce the number of bytes sent over
      the connection. By default, connections are uncompressed, but can
      be compressed if the server and the client agree on a mutually
      permitted compression algorithm.
  </p>
  <p>
   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.
  </p>
  <p>
   This section describes the available compression-control
      configuration parameters and the information sources available for
      monitoring use of compression. It applies to classic MySQL protocol
      connections.
  </p>
  <p>
   Compression control applies to connections to the server by client
      programs and by servers participating in source/replica
      replication or Group Replication. Compression control does not
      apply to connections for
   <code class="literal">
    FEDERATED
   </code>
   tables. In
      the following discussion,
   <span class="quote">
    “
    <span class="quote">
     client connection
    </span>
    ”
   </span>
   is
      shorthand for a connection to the server originating from any
      source for which compression is supported, unless context
      indicates a specific connection type.
  </p>
  <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
   <div class="admon-title">
    Note
   </div>
   <p>
    X Protocol connections to a MySQL Server instance support
        compression, but compression for X Protocol connections
        operates independently from the compression for
        classic MySQL protocol connections described here, and is controlled
        separately. See
    <a class="xref" href="x-plugin-connection-compression.html" title="22.5.5 Connection Compression with X Plugin">
     Section 22.5.5, “Connection Compression with X Plugin”
    </a>
    for
        information on X Protocol connection compression.
   </p>
  </div>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <a class="xref" href="connection-compression-control.html#connection-compression-configuration" title="Configuring Connection Compression">
       Configuring Connection Compression
      </a>
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="xref" href="connection-compression-control.html#connection-compression-legacy-configuration" title="Configuring Legacy Connection Compression">
       Configuring Legacy Connection Compression
      </a>
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="xref" href="connection-compression-control.html#connection-compression-monitoring" title="Monitoring Connection Compression">
       Monitoring Connection Compression
      </a>
     </p>
    </li>
   </ul>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h4 class="title">
       <a name="connection-compression-configuration">
       </a>
       Configuring Connection Compression
      </h4>
     </div>
    </div>
   </div>
   <p>
    These configuration parameters are available for controlling
        connection compression:
   </p>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       The
       <a class="link" href="server-system-variables.html#sysvar_protocol_compression_algorithms">
        <code class="literal">
         protocol_compression_algorithms
        </code>
       </a>
       system variable configures which compression algorithms the
            server permits for incoming connections.
      </p>
     </li>
     <li class="listitem">
      <p>
       The
       <a class="link" href="connection-options.html#option_general_compression-algorithms">
        <code class="option">
         --compression-algorithms
        </code>
       </a>
       and
       <a class="link" href="connection-options.html#option_general_zstd-compression-level">
        <code class="option">
         --zstd-compression-level
        </code>
       </a>
       command-line options configure permitted compression
            algorithms and
       <code class="literal">
        zstd
       </code>
       compression level for
            these client programs:
       <a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
        <span class="command">
         <strong>
          mysql
         </strong>
        </span>
       </a>
       ,
       <a class="link" href="mysqladmin.html" title="6.5.2 mysqladmin — A MySQL Server Administration Program">
        <span class="command">
         <strong>
          mysqladmin
         </strong>
        </span>
       </a>
       ,
       <a class="link" href="mysqlbinlog.html" title="6.6.9 mysqlbinlog — Utility for Processing Binary Log Files">
        <span class="command">
         <strong>
          mysqlbinlog
         </strong>
        </span>
       </a>
       ,
       <a class="link" href="mysqlcheck.html" title="6.5.3 mysqlcheck — A Table Maintenance Program">
        <span class="command">
         <strong>
          mysqlcheck
         </strong>
        </span>
       </a>
       ,
       <a class="link" href="mysqldump.html" title="6.5.4 mysqldump — A Database Backup Program">
        <span class="command">
         <strong>
          mysqldump
         </strong>
        </span>
       </a>
       ,
       <a class="link" href="mysqlimport.html" title="6.5.5 mysqlimport — A Data Import Program">
        <span class="command">
         <strong>
          mysqlimport
         </strong>
        </span>
       </a>
       ,
       <a class="link" href="mysqlshow.html" title="6.5.6 mysqlshow — Display Database, Table, and Column Information">
        <span class="command">
         <strong>
          mysqlshow
         </strong>
        </span>
       </a>
       ,
       <a class="link" href="mysqlslap.html" title="6.5.7 mysqlslap — A Load Emulation Client">
        <span class="command">
         <strong>
          mysqlslap
         </strong>
        </span>
       </a>
       ,
            and
       <span class="command">
        <strong>
         mysqltest
        </strong>
       </span>
       . MySQL Shell also offers
            these command-line options.
      </p>
     </li>
     <li class="listitem">
      <p>
       The
       <code class="literal">
        MYSQL_OPT_COMPRESSION_ALGORITHMS
       </code>
       and
       <code class="literal">
        MYSQL_OPT_ZSTD_COMPRESSION_LEVEL
       </code>
       options
            for the
       <a class="ulink" href="/doc/c-api/8.4/en/mysql-options.html" target="_top">
        <code class="literal">
         mysql_options()
        </code>
       </a>
       function configure permitted compression algorithms and
       <code class="literal">
        zstd
       </code>
       compression level for client
            programs that use the MySQL C API.
      </p>
     </li>
     <li class="listitem">
      <p>
       The
       <code class="literal">
        SOURCE_COMPRESSION_ALGORITHMS
       </code>
       and
       <code class="literal">
        SOURCE_ZSTD_COMPRESSION_LEVEL
       </code>
       options for
            the
       <a class="link" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
        <code class="literal">
         CHANGE REPLICATION SOURCE
            TO
        </code>
       </a>
       statement configure permitted compression
            algorithms and
       <code class="literal">
        zstd
       </code>
       compression level for
            replica servers participating in source/replica replication.
      </p>
     </li>
     <li class="listitem">
      <p>
       The
       <a class="link" href="group-replication-system-variables.html#sysvar_group_replication_recovery_compression_algorithms">
        <code class="literal">
         group_replication_recovery_compression_algorithms
        </code>
       </a>
       and
       <a class="link" href="group-replication-system-variables.html#sysvar_group_replication_recovery_zstd_compression_level">
        <code class="literal">
         group_replication_recovery_zstd_compression_level
        </code>
       </a>
       system variables configure permitted compression algorithms
            and
       <code class="literal">
        zstd
       </code>
       compression level for Group
            Replication recovery connections when a new member joins a
            group and connects to a donor.
      </p>
     </li>
    </ul>
   </div>
   <p>
    Configuration parameters that enable specifying compression
        algorithms are string-valued and take a list of one or more
        comma-separated compression algorithm names, in any order,
        chosen from the following items (not case-sensitive):
   </p>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       <code class="literal">
        zlib
       </code>
       : Permit connections that use the
       <code class="literal">
        zlib
       </code>
       compression algorithm.
      </p>
     </li>
     <li class="listitem">
      <p>
       <code class="literal">
        zstd
       </code>
       : Permit connections that use the
       <code class="literal">
        zstd
       </code>
       compression algorithm.
      </p>
     </li>
     <li class="listitem">
      <p>
       <code class="literal">
        uncompressed
       </code>
       : Permit uncompressed
            connections.
      </p>
     </li>
    </ul>
   </div>
   <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
    <div class="admon-title">
     Note
    </div>
    <p>
     Because
     <code class="literal">
      uncompressed
     </code>
     is an algorithm name
          that may or may not be configured, it is possible to configure
          MySQL
     <span class="emphasis">
      <em>
       not
      </em>
     </span>
     to permit uncompressed
          connections.
    </p>
   </div>
   <p>
    Examples:
   </p>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       To configure which compression algorithms the server permits
            for incoming connections, set the
       <a class="link" href="server-system-variables.html#sysvar_protocol_compression_algorithms">
        <code class="literal">
         protocol_compression_algorithms
        </code>
       </a>
       system variable. By default, the server permits all
            available algorithms. To configure that setting explicitly
            at startup, use these lines in the server
       <code class="filename">
        my.cnf
       </code>
       file:
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-ini"><div class="docs-select-all right" id="sa33839245"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-ini"><span class="token selector">[mysqld]</span>
<span class="token constant">protocol_compression_algorithms</span><span class="token attr-value"><span class="token punctuation">=</span>zlib,zstd,uncompressed</span></code></pre>
      </div>
      <p>
       To set and persist the
       <a class="link" href="server-system-variables.html#sysvar_protocol_compression_algorithms">
        <code class="literal">
         protocol_compression_algorithms
        </code>
       </a>
       system variable to that value at runtime, use this
            statement:
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa14224824"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SET</span> <span class="token keyword">PERSIST</span> protocol_compression_algorithms<span class="token operator">=</span><span class="token string">'zlib,zstd,uncompressed'</span><span class="token punctuation">;</span></code></pre>
      </div>
      <p>
       <a class="link" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
        <code class="literal">
         SET
            PERSIST
        </code>
       </a>
       sets a value for the running MySQL
            instance. It also saves the value, causing it to carry over
            to subsequent server restarts. To change the value for the
            running MySQL instance without having it carry over to
            subsequent restarts, use the
       <code class="literal">
        GLOBAL
       </code>
       keyword rather than
       <code class="literal">
        PERSIST
       </code>
       . See
       <a class="xref" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
        Section 15.7.6.1, “SET Syntax for Variable Assignment”
       </a>
       .
      </p>
     </li>
     <li class="listitem">
      <p>
       To permit only incoming connections that use
       <code class="literal">
        zstd
       </code>
       compression, configure the server at
            startup like this:
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-ini"><div class="docs-select-all right" id="sa57839381"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-ini"><span class="token selector">[mysqld]</span>
<span class="token constant">protocol_compression_algorithms</span><span class="token attr-value"><span class="token punctuation">=</span>zstd</span></code></pre>
      </div>
      <p>
       Or, to make the change at runtime:
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa62344649"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SET</span> <span class="token keyword">PERSIST</span> protocol_compression_algorithms<span class="token operator">=</span><span class="token string">'zstd'</span><span class="token punctuation">;</span></code></pre>
      </div>
     </li>
     <li class="listitem">
      <p>
       To permit the
       <a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
        <span class="command">
         <strong>
          mysql
         </strong>
        </span>
       </a>
       client to initiate
       <code class="literal">
        zlib
       </code>
       or
       <code class="literal">
        uncompressed
       </code>
       connections, invoke it like this:
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa14112094"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal">mysql <span class="token constant">--compression-algorithms</span><span class="token attr-value"><span class="token punctuation">=</span>zlib,uncompressed</span></code></pre>
      </div>
     </li>
     <li class="listitem">
      <p>
       To configure replicas to connect to the source using
       <code class="literal">
        zlib
       </code>
       or
       <code class="literal">
        zstd
       </code>
       connections, with a compression level of 7 for
       <code class="literal">
        zstd
       </code>
       connections, use a
       <a class="link" href="change-replication-source-to.html" title="15.4.2.2 CHANGE REPLICATION SOURCE TO Statement">
        <code class="literal">
         CHANGE REPLICATION SOURCE TO
        </code>
       </a>
       statement:
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa66684271"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CHANGE</span> <span class="token keyword">REPLICATION</span> <span class="token keyword">SOURCE</span> <span class="token keyword">TO</span>
  <span class="token keyword">SOURCE_COMPRESSION_ALGORITHMS</span> <span class="token operator">=</span> <span class="token string">'zlib,zstd'</span><span class="token punctuation">,</span>
  <span class="token keyword">SOURCE_ZSTD_COMPRESSION_LEVEL</span> <span class="token operator">=</span> <span class="token number">7</span><span class="token punctuation">;</span></code></pre>
      </div>
      <p>
       This assumes that the
       <a class="link" href="replication-options-replica.html#sysvar_replica_compressed_protocol">
        <code class="literal">
         replica_compressed_protocol
        </code>
       </a>
       system variable is disabled, for reasons described in
       <a class="xref" href="connection-compression-control.html#connection-compression-legacy-configuration" title="Configuring Legacy Connection Compression">
        Configuring Legacy Connection Compression
       </a>
       .
      </p>
     </li>
    </ul>
   </div>
   <p>
    For successful connection setup, both sides of the connection
        must agree on a mutually permitted compression algorithm. The
        algorithm-negotiation process attempts to use
    <code class="literal">
     zlib
    </code>
    , then
    <code class="literal">
     zstd
    </code>
    , then
    <code class="literal">
     uncompressed
    </code>
    . If the two sides can find no
        common algorithm, the connection attempt fails.
   </p>
   <p>
    Because both sides must agree on the compression algorithm, and
        because
    <code class="literal">
     uncompressed
    </code>
    is an algorithm value
        that is not necessarily permitted, fallback to an uncompressed
        connection does not necessarily occur. For example, if the
        server is configured to permit
    <code class="literal">
     zstd
    </code>
    and a
        client is configured to permit
    <code class="literal">
     zlib,uncompressed
    </code>
    , the client cannot connect
        at all. In this case, no algorithm is common to both sides, so
        connection attempts fail.
   </p>
   <p>
    Configuration parameters that enable specifying the
    <code class="literal">
     zstd
    </code>
    compression level take an integer value
        from 1 to 22, with larger values indicating increasing levels of
        compression. The default
    <code class="literal">
     zstd
    </code>
    compression
        level is 3. The compression level setting has no effect on
        connections that do not use
    <code class="literal">
     zstd
    </code>
    compression.
   </p>
   <p>
    A configurable
    <code class="literal">
     zstd
    </code>
    compression level enables
        choosing between less network traffic and higher CPU load versus
        more network traffic and lower CPU load. Higher compression
        levels reduce network congestion but the additional CPU load may
        reduce server performance.
   </p>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h4 class="title">
       <a name="connection-compression-legacy-configuration">
       </a>
       Configuring Legacy Connection Compression
      </h4>
     </div>
    </div>
   </div>
   <p>
    Prior to MySQL 8.0.18, these configuration parameters are
        available for controlling connection compression:
   </p>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       Client programs support a
       <a class="link" href="connection-options.html#option_general_compress">
        <code class="option">
         --compress
        </code>
       </a>
       command-line
            option to specify use of compression for the connection to
            the server.
      </p>
     </li>
     <li class="listitem">
      <p>
       For programs that use the MySQL C API, enabling the
       <code class="literal">
        MYSQL_OPT_COMPRESS
       </code>
       option for the
       <a class="ulink" href="/doc/c-api/8.4/en/mysql-options.html" target="_top">
        <code class="literal">
         mysql_options()
        </code>
       </a>
       function
            specifies use of compression for the connection to the
            server.
      </p>
     </li>
     <li class="listitem">
      <p>
       For source/replica replication, enabling the system variable
       <a class="link" href="replication-options-replica.html#sysvar_replica_compressed_protocol">
        <code class="literal">
         replica_compressed_protocol
        </code>
       </a>
       specifies use of compression for replica connections to the
            source.
      </p>
     </li>
    </ul>
   </div>
   <p>
    In each case, when use of compression is specified, the
        connection uses the
    <code class="literal">
     zlib
    </code>
    compression
        algorithm if both sides permit it, with fallback to an
        uncompressed connection otherwise.
   </p>
   <p>
    As of MySQL 8.0.18, the compression parameters just described
        become legacy parameters, due to the additional compression
        parameters introduced for more control over connection
        compression that are described in
    <a class="xref" href="connection-compression-control.html#connection-compression-configuration" title="Configuring Connection Compression">
     Configuring Connection Compression
    </a>
    . An
        exception is MySQL Shell, where the
    <a class="ulink" href="/doc/mysql-shell/8.4/en/mysqlsh.html#option_mysqlsh_compress" target="_top">
     <code class="option">
      --compress
     </code>
    </a>
    command-line option
        remains current, and can be used to request compression without
        selecting compression algorithms. For information on
        MySQL Shell's connection compression control, see
    <a class="ulink" href="/doc/mysql-shell/8.4/en/mysql-shell-compressed-connections.html" target="_top">
     Using Compressed Connections
    </a>
    .
   </p>
   <p>
    The legacy compression parameters interact with the newer
        parameters and their semantics change as follows:
   </p>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       The meaning of the legacy
       <a class="link" href="connection-options.html#option_general_compress">
        <code class="option">
         --compress
        </code>
       </a>
       option depends on
            whether
       <a class="link" href="connection-options.html#option_general_compression-algorithms">
        <code class="option">
         --compression-algorithms
        </code>
       </a>
       is
            specified:
      </p>
      <div class="itemizedlist">
       <ul class="itemizedlist" style="list-style-type: circle; ">
        <li class="listitem">
         <p>
          When
          <a class="link" href="connection-options.html#option_general_compression-algorithms">
           <code class="option">
            --compression-algorithms
           </code>
          </a>
          is not specified,
          <a class="link" href="connection-options.html#option_general_compress">
           <code class="option">
            --compress
           </code>
          </a>
          is equivalent
                to specifying a client-side algorithm set of
          <code class="literal">
           zlib,uncompressed
          </code>
          .
         </p>
        </li>
        <li class="listitem">
         <p>
          When
          <a class="link" href="connection-options.html#option_general_compression-algorithms">
           <code class="option">
            --compression-algorithms
           </code>
          </a>
          is specified,
          <a class="link" href="connection-options.html#option_general_compress">
           <code class="option">
            --compress
           </code>
          </a>
          is equivalent to specifying an algorithm set of
          <code class="literal">
           zlib
          </code>
          and the full client-side
                algorithm set is the union of
          <code class="literal">
           zlib
          </code>
          plus the algorithms specified by
          <a class="link" href="connection-options.html#option_general_compression-algorithms">
           <code class="option">
            --compression-algorithms
           </code>
          </a>
          .
                For example, with both
          <a class="link" href="connection-options.html#option_general_compress">
           <code class="option">
            --compress
           </code>
          </a>
          and
          <a class="link" href="connection-options.html#option_general_compression-algorithms">
           <code class="option">
            --compression-algorithms=zlib,zstd
           </code>
          </a>
          ,
                the permitted-algorithm set is
          <code class="literal">
           zlib
          </code>
          plus
          <code class="literal">
           zlib,zstd
          </code>
          ; that is,
          <code class="literal">
           zlib,zstd
          </code>
          . With both
          <a class="link" href="connection-options.html#option_general_compress">
           <code class="option">
            --compress
           </code>
          </a>
          and
          <a class="link" href="connection-options.html#option_general_compression-algorithms">
           <code class="option">
            --compression-algorithms=zstd,uncompressed
           </code>
          </a>
          ,
                the permitted-algorithm set is
          <code class="literal">
           zlib
          </code>
          plus
          <code class="literal">
           zstd,uncompressed
          </code>
          ; that is,
          <code class="literal">
           zlib,zstd,uncompressed
          </code>
          .
         </p>
        </li>
       </ul>
      </div>
     </li>
     <li class="listitem">
      <p>
       The same type of interaction occurs between the legacy
       <code class="literal">
        MYSQL_OPT_COMPRESS
       </code>
       option and the
       <code class="literal">
        MYSQL_OPT_COMPRESSION_ALGORITHMS
       </code>
       option
            for the
       <a class="ulink" href="/doc/c-api/8.4/en/mysql-options.html" target="_top">
        <code class="literal">
         mysql_options()
        </code>
       </a>
       C
            API function.
      </p>
     </li>
     <li class="listitem">
      <p>
       If the
       <a class="link" href="replication-options-replica.html#sysvar_replica_compressed_protocol">
        <code class="literal">
         replica_compressed_protocol
        </code>
       </a>
       system variable is enabled, it takes precedence over
       <code class="literal">
        SOURCE_COMPRESSION_ALGORITHMS
       </code>
       and
            connections to the source use
       <code class="literal">
        zlib
       </code>
       compression if both source and replica permit that
            algorithm. If
       <a class="link" href="replication-options-replica.html#sysvar_replica_compressed_protocol">
        <code class="literal">
         replica_compressed_protocol
        </code>
       </a>
       is disabled, the value of
       <code class="literal">
        SOURCE_COMPRESSION_ALGORITHMS
       </code>
       applies.
      </p>
     </li>
    </ul>
   </div>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h4 class="title">
       <a name="connection-compression-monitoring">
       </a>
       Monitoring Connection Compression
      </h4>
     </div>
    </div>
   </div>
   <p>
    The
    <a class="link" href="server-status-variables.html#statvar_Compression">
     <code class="literal">
      Compression
     </code>
    </a>
    status
        variable is
    <code class="literal">
     ON
    </code>
    or
    <code class="literal">
     OFF
    </code>
    to
        indicate whether the current connection uses compression.
   </p>
   <p>
    The
    <a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
     <span class="command">
      <strong>
       mysql
      </strong>
     </span>
    </a>
    client
    <code class="literal">
     \status
    </code>
    command displays a line that says
    <code class="literal">
     Protocol:
        Compressed
    </code>
    if compression is enabled for the current
        connection. If that line is not present, the connection is
        uncompressed.
   </p>
   <p>
    The MySQL Shell
    <code class="literal">
     \status
    </code>
    command displays a
    <code class="literal">
     Compression:
    </code>
    line that says
    <code class="literal">
     Disabled
    </code>
    or
    <code class="literal">
     Enabled
    </code>
    to
        indicate whether the connection is compressed.
   </p>
   <p>
    These additional sources of information are available for
        monitoring connection compression:
   </p>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       To monitor compression in use for client connections, use
            the
       <a class="link" href="server-status-variables.html#statvar_Compression_algorithm">
        <code class="literal">
         Compression_algorithm
        </code>
       </a>
       and
       <a class="link" href="server-status-variables.html#statvar_Compression_level">
        <code class="literal">
         Compression_level
        </code>
       </a>
       status variables. For the current connection, their values
            indicate the compression algorithm and compression level,
            respectively.
      </p>
     </li>
     <li class="listitem">
      <p>
       To determine which compression algorithms the server is
            configured to permit for incoming connections, check the
       <a class="link" href="server-system-variables.html#sysvar_protocol_compression_algorithms">
        <code class="literal">
         protocol_compression_algorithms
        </code>
       </a>
       system variable.
      </p>
     </li>
     <li class="listitem">
      <p>
       For source/replica replication connections, the configured
            compression algorithms and compression level are available
            from multiple sources:
      </p>
      <div class="itemizedlist">
       <ul class="itemizedlist" style="list-style-type: circle; ">
        <li class="listitem">
         <p>
          The Performance Schema
          <a class="link" href="performance-schema-replication-connection-configuration-table.html" title="29.12.11.11 The replication_connection_configuration Table">
           <code class="literal">
            replication_connection_configuration
           </code>
          </a>
          table has
          <code class="literal">
           COMPRESSION_ALGORITHMS
          </code>
          and
          <code class="literal">
           ZSTD_COMPRESSION_LEVEL
          </code>
          columns.
         </p>
        </li>
        <li class="listitem">
         <p>
          The
          <code class="literal">
           mysql.slave_master_info
          </code>
          system
                table has
          <code class="literal">
           Master_compression_algorithms
          </code>
          and
          <code class="literal">
           Master_zstd_compression_level
          </code>
          columns. If the
          <code class="filename">
           master.info
          </code>
          file
                exists, it contains lines for those values as well.
         </p>
        </li>
       </ul>
      </div>
     </li>
    </ul>
   </div>
  </div>
 </div>
 <br/>
</div>
