From 996e7fd7d5d595aa674ec32f9f3814f96137c324 Mon Sep 17 00:00:00 2001 From: Monty Date: Tue, 3 Dec 2024 19:08:10 +0200 Subject: [PATCH] Avoid printing "rowid_filter_skipped" in optimizer trace if no rowid filter There is no point in saying something is skipped when it does not exists. --- mysql-test/main/opt_trace.result | 1 - sql/sql_select.cc | 7 +++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/mysql-test/main/opt_trace.result b/mysql-test/main/opt_trace.result index ff9797a7072..8120914acaf 100644 --- a/mysql-test/main/opt_trace.result +++ b/mysql-test/main/opt_trace.result @@ -4134,7 +4134,6 @@ explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3 { "rec_per_key_stats_missing": true, "used_range_estimates": false, "cause": "not better than ref estimates", - "rowid_filter_skipped": "worst/max seeks clipping", "rows": 2, "cost": 3.003514767, "chosen": true diff --git a/sql/sql_select.cc b/sql/sql_select.cc index a4e57a759ff..024743f02f3 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -8704,8 +8704,11 @@ best_access_path(JOIN *join, if (!(records < s->worst_seeks && records <= thd->variables.max_seeks_for_key)) { - // Don't use rowid filter - trace_access_idx.add("rowid_filter_skipped", "worst/max seeks clipping"); + if (table->range_rowid_filter_cost_info_elems) + { + // Don't use rowid filter + trace_access_idx.add("rowid_filter_skipped", "worst/max seeks clipping"); + } filter= NULL; } else