← Back to team overview

maria-developers team mailing list archive

Re: MDEV-27036: duplicated keys in best_access_path

 

Hi Sergei,

> commit d2b4782200ccfd0850f36d25c75082974e4b86e1
> Author: Sergei Krivonos <sergei.krivonos@xxxxxxxxxxx>
> Date:   Sun Nov 14 10:37:20 2021 +0200
>
>     MDEV-27036: duplicated keys in best_access_path
>
> diff --git a/sql/sql_select.cc b/sql/sql_select.cc
> index 3272f8b7f65..29e9c0efe36 100644
> --- a/sql/sql_select.cc
> +++ b/sql/sql_select.cc
> @@ -7611,16 +7611,14 @@ best_access_path(JOIN      *join,
>                }
>                else
>                {
> +                trace_access_idx.add("used_range_estimates", false);
>                  if (table->quick_keys.is_set(key))
>                  {
> -                  trace_access_idx.add("used_range_estimates",false)
> -                                  .add("cause",
> -                                       "not better than ref estimates");
> +                  cause= "not better than ref estimates";

Issue #1: you make this change here, in the branch marked as
ReuseRangeEstimateForRef-2.  But there's very similar code right above, in 
ReuseRangeEstimateForRef-1 branch:

                /* quick_range couldn't use key! */
                records= (double) s->records/rec;
                trace_access_idx.add("used_range_estimates", false)
                                .add("cause", "not available");

Issue #2: this patch causes some information to be removed from the trace!

How about an alternative solution: change the name from "cause" here to "reason"? 

>                  }
>                  else
>                  {
> -                  trace_access_idx.add("used_range_estimates", false)
> -                                  .add("cause", "not available");
> +                  cause= "not available";
>                  }
>                }
>              }

BR
 Sergei
-- 
Sergei Petrunia, Software Developer
MariaDB Corporation | Skype: sergefp | Blog: http://petrunia.net