Bug #69915 statement/com/Query counter doesn't increment
Submitted: 2 Aug 2013 23:59 Modified: 11 Oct 2013 15:44
Reporter: Todd Farmer (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Performance Schema Severity:S3 (Non-critical)
Version:5.6.13 OS:Any
Assigned to: Marc ALFF CPU Architecture:Any

[2 Aug 2013 23:59] Todd Farmer
Description:
In looking at the various COM commands via P_S, I noticed that COM_QUERY seems to be stuck at zero:

mysql> SELECT * FROM setup_instruments
    -> WHERE name LIKE 'statement/com/Query';
+---------------------+---------+-------+
| NAME                | ENABLED | TIMED |
+---------------------+---------+-------+
| statement/com/Query | YES     | YES   |
+---------------------+---------+-------+
1 row in set (0.00 sec)

mysql> SELECT event_name, count_star, sum_errors
    -> FROM events_statements_summary_global_by_event_name
    -> WHERE event_name LIKE 'statement/com/Query';
+---------------------+------------+------------+
| event_name          | count_star | sum_errors |
+---------------------+------------+------------+
| statement/com/Query |          0 |          0 |
+---------------------+------------+------------+
1 row in set (0.01 sec)

That seems patently wrong, considering I just executed several queries which were surely sent as COM_QUERY.

How to repeat:
See above.

Suggested fix:
Make sure COM_QUERY counter is properly implemented?
[3 Aug 2013 0:06] Todd Farmer
Other counters are being incremented as expected:

mysql> SELECT event_name, count_star, sum_errors
    -> FROM events_statements_summary_global_by_event_name
    -> WHERE event_name LIKE 'statement/com/Quit';
+--------------------+------------+------------+
| event_name         | count_star | sum_errors |
+--------------------+------------+------------+
| statement/com/Quit |          1 |          0 |
+--------------------+------------+------------+
1 row in set (0.00 sec)

mysql> exit
Bye

D:\mysql-advanced-5.6.11-win32>bin\mysql -uroot -P3307 performance_schema
Welcome to the MySQL monitor.  Commands end with ; or \g.
...
mysql> SELECT event_name, count_star, sum_errors
    -> FROM events_statements_summary_global_by_event_name
    -> WHERE event_name LIKE 'statement/com/Quit';
+--------------------+------------+------------+
| event_name         | count_star | sum_errors |
+--------------------+------------+------------+
| statement/com/Quit |          2 |          0 |
+--------------------+------------+------------+
1 row in set (0.00 sec)
[11 Oct 2013 15:44] Marc ALFF
Resolved with related bug, see
http://bugs.mysql.com/bug.php?id=69928

Noted in 5.6.15, 5.7.3 changelogs.

Several statement instruments in the setup_instruments table are used
by the Performance Schema during the early stages of statement 
classification before the exact statement type is known. These
instruments were renamed to more clearly reflect their "abstract"
nature: 

statement/abstract/new_packet (renamed from statement/com/)
statement/abstract/Query      (renamed from statement/com/Query)
statement/abstract/relay_log  (renamed from statement/rpl/relay_log)

In addition, statistics for abstract instruments are no longer
collected in the following tables, because no such instrument is ever
used as the final classification for a statement:

events_statements_summary_by_thread_by_event_name
events_statements_summary_by_account_by_event_name
events_statements_summary_by_user_by_event_name
events_statements_summary_by_host_by_event_name
events_statements_summary_global_by_event_name

Applications that refer to the old instrument names must be updated
with the new names. For more information about the use of abstract
instruments in statement classification, see
http://dev.mysql.com/doc/refman/5.7/en/performance-schema-statements-tables.html.