Bug #76882 table_io_waits_summary_by_index_usage does not show correct index names
Submitted: 29 Apr 2015 11:24 Modified: 12 May 2015 16:30
Reporter: Øystein Grøvlen Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Performance Schema Severity:S3 (Non-critical)
Version:5.7.6 OS:Any
Assigned to: CPU Architecture:Any

[29 Apr 2015 11:24] Øystein Grøvlen
Description:
index_name column of performance_schema.table_io_waits_summary_by_index_usage no longer shows correct index name.  Instead names like "(index 0)" is shown.

Works correct in MySQL 5.7.5

How to repeat:
USE test;

CREATE TABLE t (i INTEGER, c CHAR(1),  KEY idx (i));

INSERT INTO t VALUES (1, 'a'), (2, 'b'), (3, 'c');

SELECT * FROM t WHERE i = 2;

SELECT index_name FROM performance_schema.table_io_waits_summary_by_index_usage
WHERE object_schema = 'test' AND object_name = 't';

DROP TABLE t;
[29 Apr 2015 13:31] Øystein Grøvlen
Posted by developer:
 
Hi, 

I tried adding 

FLUSH TABLE t;
FLUSH TABLE performance_schema.table_io_waits_summary_by_index_usage;
FLUSH TABLES;

to the script, but that did not change anything.

I also tried the following:
1. Created table in 5.7.5
2. Ran query against table
3. Checked table_io_waits_summary_by_index_usage, it showed "idx"
4. Restarted server with 5.7.6 (NB! No upgrade script was run.)
5. Ran query against table
6. Checked table_io_waits_summary_by_index_usage, it showed "(index 0)"
[29 Apr 2015 14:14] Øystein Grøvlen
Posted by developer:
 
Got the script to work with FLUSH TABLES, but I needed to place the FLUSH after the execution of the query.

If I restart the server and execute the query, I see "(index 0)" again.  Another FLUSH TABLE makes it show the correct name.

Does this mean that if index has not been access since server restart, a FLUSH TABLE is needed for existing connections to see the index name?  That seems a bit awkward even in production.
[12 May 2015 16:30] Paul DuBois
Noted in 5.7.8, 5.8.0 changelogs.

The INDEX_NAME column of the Performance Schema
table_io_waits_summary_by_index_usage table could sometimes show
incorrect index names for tables until they had been in use for some
time.