BUG#12427262 : 60961: SHOW TABLES VERY SLOW WHEN NOT IN SYSTEM DISK CACHE
Details: - Merge : 5.1 -> 5.5 - Addded a new test case which was not added in 5.1 because PS was not there in 5.1.
This commit is contained in:
commit
2786a6e232
53
mysql-test/r/bug12427262.result
Normal file
53
mysql-test/r/bug12427262.result
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
#
|
||||||
|
# Bug#12427262 : 60961: SHOW TABLES VERY SLOW WHEN NOT IN SYSTEM DISK CACHE.
|
||||||
|
#
|
||||||
|
create database show_table_db;
|
||||||
|
use show_table_db;
|
||||||
|
create table t1 (c1 int);
|
||||||
|
create table t2 (c1 int);
|
||||||
|
create table t3 (c1 int);
|
||||||
|
create table t4 (c1 int);
|
||||||
|
create table t5 (c1 int);
|
||||||
|
create table t6 (c1 int);
|
||||||
|
create table t7 (c1 int);
|
||||||
|
create table t8 (c1 int);
|
||||||
|
create table t9 (c1 int);
|
||||||
|
create table t10 (c1 int);
|
||||||
|
select Sum(ALL(COUNT_READ)) from performance_schema.file_summary_by_instance where FILE_NAME
|
||||||
|
like "%show_table_db/%.frm%" AND EVENT_NAME='wait/io/file/sql/FRM' into @count_read_before;
|
||||||
|
show tables;
|
||||||
|
Tables_in_show_table_db
|
||||||
|
t1
|
||||||
|
t10
|
||||||
|
t2
|
||||||
|
t3
|
||||||
|
t4
|
||||||
|
t5
|
||||||
|
t6
|
||||||
|
t7
|
||||||
|
t8
|
||||||
|
t9
|
||||||
|
select Sum(ALL(COUNT_READ)) from performance_schema.file_summary_by_instance where FILE_NAME
|
||||||
|
like "%show_table_db/%.frm%" AND EVENT_NAME='wait/io/file/sql/FRM' into @count_read_after;
|
||||||
|
select @count_read_after-@count_read_before;
|
||||||
|
@count_read_after-@count_read_before
|
||||||
|
0.000000000000000000000000000000
|
||||||
|
show full tables;
|
||||||
|
Tables_in_show_table_db Table_type
|
||||||
|
t1 BASE TABLE
|
||||||
|
t10 BASE TABLE
|
||||||
|
t2 BASE TABLE
|
||||||
|
t3 BASE TABLE
|
||||||
|
t4 BASE TABLE
|
||||||
|
t5 BASE TABLE
|
||||||
|
t6 BASE TABLE
|
||||||
|
t7 BASE TABLE
|
||||||
|
t8 BASE TABLE
|
||||||
|
t9 BASE TABLE
|
||||||
|
select Sum(ALL(COUNT_READ)) from performance_schema.file_summary_by_instance where FILE_NAME
|
||||||
|
like "%show_table_db/%.frm%" AND EVENT_NAME='wait/io/file/sql/FRM' into @count_read_after;
|
||||||
|
select @count_read_after-@count_read_before;
|
||||||
|
@count_read_after-@count_read_before
|
||||||
|
10.000000000000000000000000000000
|
||||||
|
drop table t1;
|
||||||
|
drop database show_table_db;
|
48
mysql-test/t/bug12427262.test
Normal file
48
mysql-test/t/bug12427262.test
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
--echo #
|
||||||
|
--echo # Bug#12427262 : 60961: SHOW TABLES VERY SLOW WHEN NOT IN SYSTEM DISK CACHE.
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
--source include/not_embedded.inc
|
||||||
|
--source include/have_perfschema.inc
|
||||||
|
|
||||||
|
--disable_warnings
|
||||||
|
create database show_table_db;
|
||||||
|
use show_table_db;
|
||||||
|
create table t1 (c1 int);
|
||||||
|
create table t2 (c1 int);
|
||||||
|
create table t3 (c1 int);
|
||||||
|
create table t4 (c1 int);
|
||||||
|
create table t5 (c1 int);
|
||||||
|
create table t6 (c1 int);
|
||||||
|
create table t7 (c1 int);
|
||||||
|
create table t8 (c1 int);
|
||||||
|
create table t9 (c1 int);
|
||||||
|
create table t10 (c1 int);
|
||||||
|
--enable_warnings
|
||||||
|
|
||||||
|
# Query PS to know initial read count for frm file.
|
||||||
|
select Sum(ALL(COUNT_READ)) from performance_schema.file_summary_by_instance where FILE_NAME
|
||||||
|
like "%show_table_db/%.frm%" AND EVENT_NAME='wait/io/file/sql/FRM' into @count_read_before;
|
||||||
|
|
||||||
|
show tables;
|
||||||
|
|
||||||
|
# Query PS to know read count for frm file after above query. It should
|
||||||
|
# not be changed as FRM file will not be opened for above query.
|
||||||
|
select Sum(ALL(COUNT_READ)) from performance_schema.file_summary_by_instance where FILE_NAME
|
||||||
|
like "%show_table_db/%.frm%" AND EVENT_NAME='wait/io/file/sql/FRM' into @count_read_after;
|
||||||
|
|
||||||
|
select @count_read_after-@count_read_before;
|
||||||
|
|
||||||
|
show full tables;
|
||||||
|
|
||||||
|
# Query PS to know read count for frm file after above query. COUNT_READ
|
||||||
|
# will be incremented by 1 as FRM file will be opened for above query.
|
||||||
|
select Sum(ALL(COUNT_READ)) from performance_schema.file_summary_by_instance where FILE_NAME
|
||||||
|
like "%show_table_db/%.frm%" AND EVENT_NAME='wait/io/file/sql/FRM' into @count_read_after;
|
||||||
|
|
||||||
|
select @count_read_after-@count_read_before;
|
||||||
|
|
||||||
|
--disable_warnings
|
||||||
|
drop table t1;
|
||||||
|
drop database show_table_db;
|
||||||
|
--enable_warnings
|
@ -3192,7 +3192,11 @@ end:
|
|||||||
|
|
||||||
static int fill_schema_table_names(THD *thd, TABLE *table,
|
static int fill_schema_table_names(THD *thd, TABLE *table,
|
||||||
LEX_STRING *db_name, LEX_STRING *table_name,
|
LEX_STRING *db_name, LEX_STRING *table_name,
|
||||||
bool with_i_schema)
|
bool with_i_schema,
|
||||||
|
bool need_table_type)
|
||||||
|
{
|
||||||
|
/* Avoid opening FRM files if table type is not needed. */
|
||||||
|
if (need_table_type)
|
||||||
{
|
{
|
||||||
if (with_i_schema)
|
if (with_i_schema)
|
||||||
{
|
{
|
||||||
@ -3227,6 +3231,7 @@ static int fill_schema_table_names(THD *thd, TABLE *table,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (schema_table_store_record(thd, table))
|
if (schema_table_store_record(thd, table))
|
||||||
return 1;
|
return 1;
|
||||||
return 0;
|
return 0;
|
||||||
@ -3763,7 +3768,8 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
|
|||||||
if (schema_table_idx == SCH_TABLE_NAMES)
|
if (schema_table_idx == SCH_TABLE_NAMES)
|
||||||
{
|
{
|
||||||
if (fill_schema_table_names(thd, tables->table, db_name,
|
if (fill_schema_table_names(thd, tables->table, db_name,
|
||||||
table_name, with_i_schema))
|
table_name, with_i_schema,
|
||||||
|
lex->verbose))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user