1--echo #
2--echo # Bug#12427262 : 60961: SHOW TABLES VERY SLOW WHEN NOT IN SYSTEM DISK CACHE.
3--echo #
4
5--source include/not_embedded.inc
6--source include/have_perfschema.inc
7
8--disable_warnings
9create database show_table_lw_db;
10use show_table_lw_db;
11create table t1 (c1 int);
12create table t2 (c1 int);
13create table t3 (c1 int);
14create table t4 (c1 int);
15create table t5 (c1 int);
16create table t6 (c1 int);
17create table t7 (c1 int);
18create table t8 (c1 int);
19create table t9 (c1 int);
20create table t10 (c1 int);
21--enable_warnings
22
23# Query PS to know initial read count for frm file.
24select Sum(ALL(COUNT_READ)) from performance_schema.file_summary_by_instance where FILE_NAME
25like "%show_table_lw_db%" AND FILE_NAME like "%.frm%" AND EVENT_NAME='wait/io/file/sql/FRM'
26into @count_read_before;
27
28show tables;
29
30# Query PS to know read count for frm file after above query. It should
31# not be changed as FRM file will not be opened for above query.
32select Sum(ALL(COUNT_READ)) from performance_schema.file_summary_by_instance where FILE_NAME
33like "%show_table_lw_db%" AND FILE_NAME like "%.frm%" AND EVENT_NAME='wait/io/file/sql/FRM'
34into @count_read_after;
35
36select @count_read_after-@count_read_before;
37
38show full tables;
39
40# Query PS to know read count for frm file after above query. COUNT_READ
41# will be incremented by 1 as FRM file will be opened for above query.
42select Sum(ALL(COUNT_READ)) from performance_schema.file_summary_by_instance where FILE_NAME
43like "%show_table_lw_db%" AND FILE_NAME like "%.frm%" AND EVENT_NAME='wait/io/file/sql/FRM'
44into @count_read_after;
45
46select @count_read_after-@count_read_before;
47
48--disable_warnings
49drop table t1;
50drop database show_table_lw_db;
51--enable_warnings
52