MySQL Blog Archive
For the latest blogs go to
MySQL 8.0: Performance Schema Instrumentation of Server Errors

In MySQL 8.0.0, the Performance Schema can now instrument server errors. There are 5 new summary tables introduced:

As names suggest, statistics of errors in these tables are aggregated by error. So one can see number of time a particular error is seen by a specific user/host/account/thread or over all in the server.

Lets take a look at table’s description.

FIRST_SEEN/LAST_SEEN  : First and last time this error was seen.
SUM_ERROR_RAISED        : number of times a particular error is raised.
SUM_ERROR_HANDLED   : number of times a particular error is handled.

Lets talk about SUM_ERROR_HANDLED and SUM_ERROR_RAISED. In MySQL, it is possible to handle a specific error in stored programs [via the Manual]. All those errors which were handled are counted/aggregated under SUM_ERROR_HANDLED. Whereas, SUM_ERROR_RAISED is the number of all other remaining errors which were raised but not handled.

In each of these tables, there is a specific row (NULL ROW) which would aggregate all those errors which are not falling in range of MySQL Server Errors.

Let’s see all of these in action with some examples:

So we can see the error statistics is seen here. And this is aggregated under SUM_ERROR_RAISED. Now lets try to handle an error in a Stored Procedure and see its stats.

Here it could be seen that handled error is aggregated under SUM_ERROR_HANDLED column whereas earlier error is still visible under SUM_ERROR_RAISED.

Now let’s see the scenario when an error is raised which is out-of-range of MySQL Server Error codes.

Here, this error is collected in NULL ROW where ERROR_NUMBER, ERROR_NAME and SQL_STATE all are NULL.

In these examples, we have examined errors’ statistics aggregated globally. As mentioned earlier, these error’s statistics are also aggregated by user/host/account/thread and could be seen in respective tables.