From 4464aa4628745c98efad6979d55bff2df7801925 Mon Sep 17 00:00:00 2001 From: Monty Date: Fri, 28 Oct 2022 18:17:53 +0300 Subject: [PATCH] Updated number of expected rows from 2 to 100 for information_schema tables The reason is that 2 is usually way to low and as information_schema tables may have implicit locks when accessing rows, it is better that the optimizer doesn't think that these tables are 'very small and fast'. This change will affect a very small set of test cases. --- sql/sql_select.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 8fcc8717eca..a91b85474c1 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -5377,7 +5377,14 @@ make_join_statistics(JOIN *join, List &tables_list, s->dependent= tables->dep_tables; if (tables->schema_table) - table->file->stats.records= table->used_stat_records= 2; + { + /* + Information schema is slow and we don't know how many rows we will + find. Be setting a moderate ammount of rows we are more likely + to have it materialized if needed. + */ + table->file->stats.records= table->used_stat_records= 100; + } table->opt_range_condition_rows= table->stat_records(); s->on_expr_ref= &tables->on_expr;