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
6 -- vertical_results
7
8 CREATE TABLE test_ps_fetch_nonexistent
9 (a INT, PRIMARY KEY (a))
10 ENGINE=INNODB STATS_PERSISTENT=1;
11
12 # write stats to mysql.innodb_table_stats
13 ANALYZE TABLE test_ps_fetch_nonexistent;
14
15 # check that indeed stats were written by ANALYZE above
16 SELECT COUNT(*)
17 FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_fetch_nonexistent';
18
19 # delete the stats
20 DELETE FROM mysql.innodb_index_stats WHERE table_name = 'test_ps_fetch_nonexistent';
21 DELETE FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_fetch_nonexistent';
22
23 # reopen the table, this will attept to read the stats
24 FLUSH TABLE test_ps_fetch_nonexistent;
25
26 # check the stats (should have been generated using the old transient stats
27 # method)
28 SELECT seq_in_index, column_name, cardinality
29 FROM information_schema.statistics WHERE table_name = 'test_ps_fetch_nonexistent'
30 ORDER BY index_name, seq_in_index;
31
32 SELECT table_rows, avg_row_length, max_data_length, index_length
33 FROM information_schema.tables WHERE table_name = 'test_ps_fetch_nonexistent';
34
35 DROP TABLE test_ps_fetch_nonexistent;