• Monty's avatar
    MDEV-22535 TABLE::initialize_quick_structures() takes 0.5% in oltp_read_only · 6cee9b19
    Monty authored
    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.
    6cee9b19
opt_subselect.cc 238 KB