1# 2# Bug#12429573 TIMESTAMP COLUMN OF INNODB.INDEX_STATS ARE NOT UPDATED 3# WHEN RE-RUNNING ANALYZE 4# 5 6-- source include/have_innodb.inc 7-- source include/not_embedded.inc 8 9CREATE TABLE bug12429573 (i INTEGER PRIMARY KEY, j INTEGER, KEY(j)) 10ENGINE=INNODB STATS_PERSISTENT=1; 11 12ANALYZE TABLE bug12429573; 13 14# Cannot check the exact timestamp here because it is always different 15# but at least check that both timestamps in innodb_table_stats and in 16# innodb_index_stats have been updated to the same value. If the bug is 17# present this check will fail. 18 19SELECT last_update FROM mysql.innodb_index_stats WHERE 20table_name = 'bug12429573' AND 21last_update NOT IN 22(SELECT last_update FROM mysql.innodb_table_stats 23 WHERE table_name = 'bug12429573'); 24 25# The first ANALYZE would insert timestamp e.g. 17:23:39 in both 26# innodb_table_stats and innodb_index_stats. The bug is that the second 27# ANALYZE only updates the timestamp in innodb_table_stats. In order to 28# check if the timestamp in innodb_index_stats has really been updated we 29# need it to be different from the previous one (17:23:39) with at least 30# one second. 31-- sleep 1 32 33ANALYZE TABLE bug12429573; 34 35# If the bug is present we get the timestamps different here. 36SELECT last_update FROM mysql.innodb_index_stats WHERE 37table_name = 'bug12429573' AND 38last_update NOT IN 39(SELECT last_update FROM mysql.innodb_table_stats 40 WHERE table_name = 'bug12429573'); 41 42DROP TABLE bug12429573; 43