• mhansson/martin@linux-st28.site's avatar
    BUG#20604: FORCE INDEX uses keys disabled by ALTER TABLE · 6d7a6097
    mhansson/martin@linux-st28.site authored
     
    The function that checks whether we can use keys for aggregates,
    find_key_for_maxmin(), assumes that keys disabled by ALTER TABLE
    ... DISABLE KEYS are not in the set table->keys_in_use_for_query.
    I.E., if a key is in this set, the optimizer assumes it is free to 
    use it.
      
    The bug is that keys disabled with ALTER TABLE ... DISABLE KEYS still
    appear in table->keys_in_use_for_query When the TABLE object has been 
    initialized with setup_tables(). Before setup_tables is called, however, 
    keys that are disabled in the aforementioned way are not included in
    TABLE::keys_in_use_for_query. 
      
    The provided patch changes the code that updates keys_is_use_for_query so 
    that it assumes that keys_is_use_for_query already takes into account all 
    disabled keys, and generally all keys that should be used by the query.
    6d7a6097
key.result 16.3 KB