diff options
Diffstat (limited to 'sql/sql_show.cc')
-rw-r--r-- | sql/sql_show.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sql/sql_show.cc b/sql/sql_show.cc index ce0e3bc6265..a29a6871b78 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -4396,6 +4396,7 @@ fill_schema_table_by_open(THD *thd, bool is_show_fields_or_keys, 'only_view_structure()'. */ lex->sql_command= SQLCOM_SHOW_FIELDS; + thd->force_read_stats= get_schema_table_idx(schema_table) == SCH_STATISTICS; result= (thd->open_temporary_tables(table_list) || open_normal_and_derived_tables(thd, table_list, (MYSQL_OPEN_IGNORE_FLUSH | @@ -4403,6 +4404,10 @@ fill_schema_table_by_open(THD *thd, bool is_show_fields_or_keys, (can_deadlock ? MYSQL_OPEN_FAIL_ON_MDL_CONFLICT : 0)), DT_INIT | DT_PREPARE | DT_CREATE)); + + (void) read_statistics_for_tables_if_needed(thd, table_list); + thd->force_read_stats= false; + /* Restore old value of sql_command back as it is being looked at in process_table() function. |