From 69d7bfd97092f050bd4c60ce79f60d48a249089b Mon Sep 17 00:00:00 2001 From: Varun Gupta Date: Fri, 24 Aug 2018 01:59:02 +0530 Subject: MDEV-17023: Crash during read_histogram_for_table with optimizer_use_condition_selectivity set to 4 No need to read statistics for tables that are not USER tables. We allocate memory for structures to collect statistics only for USER TABLES. --- sql/sql_statistics.cc | 3 +++ 1 file changed, 3 insertions(+) (limited to 'sql/sql_statistics.cc') diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc index 537ede91710..cb75a5c2176 100644 --- a/sql/sql_statistics.cc +++ b/sql/sql_statistics.cc @@ -3129,6 +3129,9 @@ int read_statistics_for_tables_if_needed(THD *thd, TABLE_LIST *tables) if (!tl->is_view_or_derived() && !is_temporary_table(tl) && tl->table) { TABLE_SHARE *table_share= tl->table->s; + if (table_share && !(table_share->table_category == TABLE_CATEGORY_USER)) + continue; + if (table_share && table_share->stats_cb.stats_can_be_read && !table_share->stats_cb.stats_is_read) -- cgit v1.2.1