Debian Codegraph @

mysql-test/suite/innodb/t/innodb_stats_rename_table.test

raw
1 #
2 # Test that RENAME TABLE renames the entries in
3 # mysql.innodb_table_stats and mysql.innodb_index_stats
4 #
5
6
7 -- vertical_results
8
9 # confirm that nothing is present before the test
10 SELECT table_name, n_rows
11 FROM mysql.innodb_table_stats
12 WHERE table_name IN ('stats_rename_old', 'stats_rename_new');
13
14 SELECT table_name, index_name, stat_name, stat_value
15 FROM mysql.innodb_index_stats
16 WHERE table_name IN ('stats_rename_old', 'stats_rename_new');
17
18 CREATE TABLE stats_rename_old (a INT, PRIMARY KEY (a))
19 ENGINE=INNODB STATS_PERSISTENT=1;
20
21 # confirm that CREATE inserted a zeroed entries
22 SELECT table_name, n_rows
23 FROM mysql.innodb_table_stats
24 WHERE table_name IN ('stats_rename_old', 'stats_rename_new');
25
26 SELECT table_name, index_name, stat_name, stat_value
27 FROM mysql.innodb_index_stats
28 WHERE table_name IN ('stats_rename_old', 'stats_rename_new');
29
30 RENAME TABLE stats_rename_old TO stats_rename_new;
31
32 # confirm that rows were updated correspondingly
33 SELECT table_name, n_rows
34 FROM mysql.innodb_table_stats
35 WHERE table_name IN ('stats_rename_old', 'stats_rename_new');
36
37 SELECT table_name, index_name, stat_name, stat_value
38 FROM mysql.innodb_index_stats
39 WHERE table_name IN ('stats_rename_old', 'stats_rename_new');
40
41 DROP TABLE stats_rename_new;