Documentation Home
MySQL Internals Manual

MySQL Internals Manual  /  ...  /  Compressed Payload

14.4.3 Compressed Payload

If the length of payload before compression is more than 0 the Compressed Packet header is followed by the compressed payload.

It uses the deflate algorithm as defined in RFC 1951 and implemented in zlib. The header of the compressed packet has the parameters of the uncompress() function in mind:

ZEXTERN int ZEXPORT uncompress OF((Bytef *dest,   uLongf *destLen,
                                 const Bytef *source, uLong sourceLen));

The payload can be anything from a piece of a MySQL Packet to several MySQL Packets. The client or server may bundle several MySQL packets, compress it and send it as one compressed packet.