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 -- source include/have_innodb.inc
7
8 -- vertical_results
9
10 # confirm that nothing is present before the test
11 SELECT table_name, n_rows
12 FROM mysql.innodb_table_stats
13 WHERE table_name IN ('stats_rename_old', 'stats_rename_new');
14
15 SELECT table_name, index_name, stat_name, stat_value
16 FROM mysql.innodb_index_stats
17 WHERE table_name IN ('stats_rename_old', 'stats_rename_new');
18
19 CREATE TABLE stats_rename_old (a INT, PRIMARY KEY (a))
20 ENGINE=INNODB STATS_PERSISTENT=1;
21
22 # confirm that CREATE inserted a zeroed entries
23 SELECT table_name, n_rows
24 FROM mysql.innodb_table_stats
25 WHERE table_name IN ('stats_rename_old', 'stats_rename_new');
26
27 SELECT table_name, index_name, stat_name, stat_value
28 FROM mysql.innodb_index_stats
29 WHERE table_name IN ('stats_rename_old', 'stats_rename_new');
30
31 RENAME TABLE stats_rename_old TO stats_rename_new;
32
33 # confirm that rows were updated correspondingly
34 SELECT table_name, n_rows
35 FROM mysql.innodb_table_stats
36 WHERE table_name IN ('stats_rename_old', 'stats_rename_new');
37
38 SELECT table_name, index_name, stat_name, stat_value
39 FROM mysql.innodb_index_stats
40 WHERE table_name IN ('stats_rename_old', 'stats_rename_new');
41
42 DROP TABLE stats_rename_new;