Bug #58058 please add instrumentation to track error counts on a server
Submitted: 8 Nov 2010 17:29 Modified: 19 Apr 2017 7:48
Reporter: Ben Krug Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Performance Schema Severity:S4 (Feature request)
Version: OS:Any
Assigned to: Marc ALFF CPU Architecture:Any

[8 Nov 2010 17:29] Ben Krug
Description:
Would be nice to be able to aggregate error counts on a server.  Ie, how many of which errors have occurred.  This could be critical for maintaining and troubleshooting a server.

Some of this can be done at an application level, but if a server is accessed in various ways (PHP, API, using a client, etc), aggregating may not be possible, unless it is done at and in the server.

How to repeat:
n/a

Suggested fix:
add instrumentation
[8 Nov 2010 17:39] Valeriy Kravchuk
Thank you for the feature request.
[2 Dec 2014 20:29] Daniƫl van Eeden
This works in 5.6.21:
use performance_schema
update setup_consumers set enabled='yes' where name='events_statements_history_long';
select sum(if(mysql_errno>0,1,0)) sum_errors from events_statements_history_long;

mysql> USE performance_schema
Database changed
mysql> update setup_consumers set enabled='yes' where name='events_statements_history_long';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> create table foo.barbar;
ERROR 1113 (42000): A table must have at least 1 column
mysql> select sum(if(mysql_errno>0,1,0)) sum_errors from events_statements_history_long;
+------------+
| sum_errors |
+------------+
|          1 |
+------------+
1 row in set (0.00 sec)

Note that SUM(errors) doesn't work because Bug #74614
[19 Apr 2017 7:48] Marc ALFF
Implemented in MySQL 8.0.0,

see

https://dev.mysql.com/doc/refman/8.0/en/error-summary-tables.html