MySQL Statement Digests

Decoupling Statement Digests From Performance Schema

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).

Statement Digests were previously only available as a part of the MySQL Performance Schema. In other words, they were only available when Performance Schema was enabled in a running MySQL Server. Now, from the MySQL 5.7.4 DMR on, this Statement Digest feature has been made available irrespective of the Performance Schema.

Why This Is Important

This change allows other MySQL Server Components and Plugins to make use of Statement Digests without being dependent on the Performance Schema configuration. One example of this is the new MySQL Query Rewrite plugin (available in the MySQL 5.7.6 DMR).

Some Additional Notes

There is no change in Performance Schema itself and it still works as it did before with regards to statement aggregation and summary information. All we’ve done is move the Statement Digest functionality to the SQL layer so that it can be used for features unrelated to Performance Schema.

The following MySQL Server options and status variables remain valid and unchanged within the Performance Schema context:

We also added a new max_digest_length MySQL Server option in order to provide greater flexibility in the behavior of Statement Digests. For more details on this new option, please see my previous post on the topic.

If you would like some additional details on this work, you can see the Worklog entry here. If you have any questions, please feel free to post them here on the blog post or in a support ticket.

As always, THANK YOU for using MySQL!

4 thoughts on “MySQL Statement Digests

  1. Does MySQL expose any functions that allow a user to normalize statements? For example, one that would normalize SQL text in the p_s.threads.processlist_info column.

  2. Why are the events_statements_current digest and digest_text columns NULL when the statement is currently executing and only populated upon completion of the statement? Is it because the statement is normalized and the digest produced only at completion? All documentation for this table that I could find indicate that the columns should be populated without mention of the caveat that the statement must be complete.

    Thanks for you time.

Leave a Reply

Your email address will not be published. Required fields are marked *

Please enter * Time limit is exhausted. Please reload CAPTCHA.