Skip to content
  • Jorgen Loland's avatar
    51145cbf
    BUG#15849135: KEYS USABLE ONLY FOR GROUPING ADDED TO · 51145cbf
    Jorgen Loland authored
                  JOIN_TAB::CONST_KEYS BUT NOT J_T::KEYS
    
    JOIN_TAB::const_keys is a map of usable keys which have constant
    predicates associated with it. Naturally, this is a a subset
    of JOIN_TAB::keys which is a map of usable keys. 
    
    Three issues are fixed with this patch:
    1) In add_group_and_distinct_keys(), indexes usable for 
       resolving GROUP BY or DISTINCT were only added to const_keys.
       Now, these are also added to keys
    2) Before this patch, add_group_and_distinct_keys() added 
       index bits to the const_keys map without checking if the
       field was even part of the table. Now the function bails
       out if GROUP BY or DISTINCT refers to a different table
       because no index on table 'a' can be used to resolve 
       GROUP BY/DISTINCT on a field from table 'b'.
    3) Before this patch, JOIN::drop_unused_derived_keys() would
       call join_tab->keys.clear_all() but forget to do the same
       with join_tab->const_keys.
    51145cbf
    BUG#15849135: KEYS USABLE ONLY FOR GROUPING ADDED TO
    Jorgen Loland authored
                  JOIN_TAB::CONST_KEYS BUT NOT J_T::KEYS
    
    JOIN_TAB::const_keys is a map of usable keys which have constant
    predicates associated with it. Naturally, this is a a subset
    of JOIN_TAB::keys which is a map of usable keys. 
    
    Three issues are fixed with this patch:
    1) In add_group_and_distinct_keys(), indexes usable for 
       resolving GROUP BY or DISTINCT were only added to const_keys.
       Now, these are also added to keys
    2) Before this patch, add_group_and_distinct_keys() added 
       index bits to the const_keys map without checking if the
       field was even part of the table. Now the function bails
       out if GROUP BY or DISTINCT refers to a different table
       because no index on table 'a' can be used to resolve 
       GROUP BY/DISTINCT on a field from table 'b'.
    3) Before this patch, JOIN::drop_unused_derived_keys() would
       call join_tab->keys.clear_all() but forget to do the same
       with join_tab->const_keys.
Loading