Menu

MySQL Statement Digests: Configurable Max Lengths

MySQL Statement Digests are a feature originally introduced as part of the MySQL Performance Schema in MySQL 5.6 to aggregate statement statistics based on the normalized statements executed within the server (for additional info, see here).

Digest calculations are done based on the tokens found in the statement text. The length to which these tokens were considered for the digest calculation was previously fixed at 1024 bytes. Which meant that while reading the tokens, once 1024 bytes were read from statement’s token stream, only that many tokens were considered when generating the Statement Digest. Due to this, statements which only differed after the first 1024 bytes would generate the same digest and thus be aggregated together.

To improve upon this behavior, this limit has been made configurable in MySQL 5.7.6 with the introduction of a new server variable called max_digest_length (range 0 – 1048576). The default value of this new server variable is 1024:

We hope that you find this new feature useful! If you have any questions please feel free to post them here on the blog post or in a support ticket. If you feel that you have encountered any related bugs, please let us know via a comment here, a bug report, or a support ticket.