1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-23677: Optimizer trace: remove "no predicate for first keypart" (not)

Don't remove (reasons given in Jira), instead add test coverage.
Improve other printout in best_access_path.
This commit is contained in:
Sergei Petrunia
2021-03-18 21:04:33 +03:00
parent 4903031baa
commit 2b3fd5dff0
3 changed files with 73 additions and 7 deletions

View File

@@ -7637,6 +7637,7 @@ best_access_path(JOIN *join,
{
if (!(records= keyinfo->actual_rec_per_key(key_parts-1)))
{ /* Prefer longer keys */
trace_access_idx.add("rec_per_key_stats_missing", true);
records=
((double) s->records / (double) rec *
(1.0 +
@@ -7663,7 +7664,7 @@ best_access_path(JOIN *join,
records > (double) table->opt_range[key].rows)
{
records= (double) table->opt_range[key].rows;
trace_access_idx.add("used_range_estimates", true);
trace_access_idx.add("used_range_estimates", "clipped down");
}
else
{
@@ -7780,19 +7781,15 @@ best_access_path(JOIN *join,
if (!found_ref && // (1)
records < rows) // (3)
{
trace_access_idx.add("used_range_estimates", true);
trace_access_idx.add("used_range_estimates", "clipped up");
records= rows;
}
}
else /* (table->quick_key_parts[key] < max_key_part) */
{
trace_access_idx.add("chosen", true);
cause= "range uses less keyparts";
}
}
}
else
{
trace_access_idx.add("rec_per_key_stats_missing", true);
/*
Assume that the first key part matches 1% of the file
and that the whole key matches 10 (duplicates) or 1
@@ -7856,6 +7853,7 @@ best_access_path(JOIN *join,
const_part)) &&
records > (double) table->opt_range[key].rows)
{
trace_access_idx.add("used_range_estimates", true);
records= (double) table->opt_range[key].rows;
}
}