Debian Codegraph @

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

raw
1 #
2 # Test fetching from stats tables while there are no stats
3 #
4
5 -- source include/have_innodb.inc
6
7 call mtr.add_suppression("InnoDB: Error: Fetch of persistent statistics requested for table *");
8
9 -- vertical_results
10
11 CREATE TABLE test_ps_fetch_nonexistent
12 (a INT, PRIMARY KEY (a))
13 ENGINE=INNODB STATS_PERSISTENT=1;
14
15 # write stats to mysql.innodb_table_stats
16 ANALYZE TABLE test_ps_fetch_nonexistent;
17
18 # check that indeed stats were written by ANALYZE above
19 SELECT COUNT(*)
20 FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_fetch_nonexistent';
21
22 # delete the stats
23 DELETE FROM mysql.innodb_index_stats WHERE table_name = 'test_ps_fetch_nonexistent';
24 DELETE FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_fetch_nonexistent';
25
26 # reopen the table, this will attept to read the stats
27 FLUSH TABLE test_ps_fetch_nonexistent;
28
29 # check the stats (should have been generated using the old transient stats
30 # method)
31 SELECT seq_in_index, column_name, cardinality
32 FROM information_schema.statistics WHERE table_name = 'test_ps_fetch_nonexistent'
33 ORDER BY index_name, seq_in_index;
34
35 SELECT table_rows, avg_row_length, max_data_length, index_length
36 FROM information_schema.tables WHERE table_name = 'test_ps_fetch_nonexistent';
37
38 DROP TABLE test_ps_fetch_nonexistent;