Documentation Home
MySQL Internals Manual
Download this Manual
EPUB - 0.8Mb


MySQL Internals Manual  /  ...  /  Example: One MySQL Packet

14.4.3.1 Example: One MySQL Packet

A COM_QUERY for select "012345678901234567890123456789012345" without CLIENT_COMPRESS has a payload length of 46 bytes looks like:

2e 00 00 00 03 73 65 6c    65 63 74 20 22 30 31 32    .....select "012
33 34 35 36 37 38 39 30    31 32 33 34 35 36 37 38    3456789012345678
39 30 31 32 33 34 35 36    37 38 39 30 31 32 33 34    9012345678901234
35 22                                                 5"

with CLIENT_COMPRESS the packet is:

22 00 00 00 32 00 00 78    9c d3 63 60 60 60 2e 4e    "...2..x..c```.N
cd 49 4d 2e 51 50 32 30    34 32 36 31 35 33 b7 b0    .IM.QP20426153..
c4 cd 52 02 00 0c d1 0a    6c                         ..R.....l

comp-length

seq-id

uncomp-len

Compressed Payload

22 00 00

00

32 00 00

compress("\x2e\x00\x00\x00\x03select ...")

The compressed packet is 41 bytes long and splits into:

raw packet length                      -> 41
compressed payload length   = 22 00 00 -> 34 (41 - 7)
sequence id                 = 00       ->  0
uncompressed payload length = 32 00 00 -> 50

User Comments
Sign Up Login You must be logged in to post a comment.