1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Make the most important optimizer constants user variables

Variables added:
- optimizer_index_block_copy_cost
- optimizer_key_copy_cost
- optimizer_key_next_find_cost
- optimizer_key_compare_cost
- optimizer_row_copy_cost
- optimizer_where_compare_cost

Some rename of defines was done to make the internal defines similar to
the visible ones:
TIME_FOR_COMPARE -> WHERE_COST; WHERE_COST was also "inverted" to be
a number between 0 and 1 that is multiply with accepted records
(similar to other optimizer variables).
TIME_FOR_COMPARE_IDX -> KEY_COMPARE_COST. This is also inverted,
similar to TIME_FOR_COMPARE.
TIME_FOR_COMPARE_ROWID -> ROWID_COMPARE_COST. This is also inverted,
similar to TIME_FOR_COMPARE.

All default costs are identical to what they where before this patch.

Other things:
- Compare factor in get_merge_buffers_cost() was inverted.
- Changed namespace to static in filesort_utils.cc
This commit is contained in:
Monty
2022-04-05 20:12:29 +03:00
committed by Sergei Petrunia
parent b6215b9b20
commit 5e651c9aea
28 changed files with 451 additions and 143 deletions

View File

@ -158,7 +158,7 @@ explain select * from t1 where a=1 or b=1 {
}
}
],
"index_roworder_union_cost": 2.595171589,
"index_roworder_union_cost": 2.601171589,
"members": 2,
"chosen": true
}
@ -187,7 +187,7 @@ explain select * from t1 where a=1 or b=1 {
]
},
"rows_for_plan": 2,
"cost_for_plan": 2.595171589,
"cost_for_plan": 2.601171589,
"chosen": true
}
}
@ -220,14 +220,14 @@ explain select * from t1 where a=1 or b=1 {
"rows": 2,
"rows_after_scan": 2,
"rows_after_filter": 2,
"cost": 2.595171589,
"cost": 2.601171589,
"chosen": true
}
],
"chosen_access_method": {
"type": "index_merge",
"records": 2,
"cost": 2.595171589,
"cost": 2.601171589,
"uses_join_buffering": false
}
}
@ -238,14 +238,14 @@ explain select * from t1 where a=1 or b=1 {
"plan_prefix": [],
"table": "t1",
"rows_for_plan": 2,
"cost_for_plan": 2.595171589
"cost_for_plan": 2.601171589
}
]
},
{
"best_join_order": ["t1"],
"rows": 2,
"cost": 2.595171589
"cost": 2.601171589
},
{
"substitute_best_equal": {
@ -630,7 +630,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives'))
}
}
],
"index_roworder_union_cost": 332.5637481,
"index_roworder_union_cost": 333.0257481,
"members": 2,
"chosen": true
}
@ -697,7 +697,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.chosen_range_access_summary'))
]
},
"rows_for_plan": 154,
"cost_for_plan": 332.5637481,
"cost_for_plan": 333.0257481,
"chosen": true
}
]