mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-22535 TABLE::initialize_quick_structures() takes 0.5% in oltp_read_only
Fixed by: - Make all quick_* variable allocated according to real number keys instead of MAX_KEY - Store all the quick* items in separated allocated structure (OPT_RANGE) - Ensure we don't access any quick* variable without first checking opt_range_keys.is_set(). Thanks to this, we don't need any pre-initialization of quick* variables anymore. Some renames was done to use the new structure: table->quick_keys -> table->opt_range_keys table->quick_rows[X] -> table->opt_range[X].rows table->quick_key_parts[X] -> table->opt_range[X].key_parts table->quick_costs[X] -> table->opt_range[X].cost table->quick_index_only_costs[X] -> table->opt_range[X].index_only_cost table->quick_n_ranges[X] -> table->opt_range[X].ranges table->quick_condition_rows -> table->opt_range_condition_rows This patch should both decrease memory needed for TABLE objects (3528 -> 984 + keyinfo) and increase performance, thanks to less initializations per query, and more localized memory, thanks to the opt_range structure.
This commit is contained in:
@ -443,7 +443,7 @@ int mysql_update(THD *thd,
|
||||
|
||||
/* Calculate "table->covering_keys" based on the WHERE */
|
||||
table->covering_keys= table->s->keys_in_use;
|
||||
table->quick_keys.clear_all();
|
||||
table->opt_range_keys.clear_all();
|
||||
|
||||
query_plan.select_lex= thd->lex->first_select_lex();
|
||||
query_plan.table= table;
|
||||
@ -577,7 +577,7 @@ int mysql_update(THD *thd,
|
||||
}
|
||||
|
||||
/* If running in safe sql mode, don't allow updates without keys */
|
||||
if (table->quick_keys.is_clear_all())
|
||||
if (table->opt_range_keys.is_clear_all())
|
||||
{
|
||||
thd->set_status_no_index_used();
|
||||
if (safe_update && !using_limit)
|
||||
|
Reference in New Issue
Block a user