• gkodinov/kgeorge@macbook.gmz's avatar
    WL#3527: Extend IGNORE INDEX so places where index is ignored · b9c82eaa
    gkodinov/kgeorge@macbook.gmz authored
             can be specified
    Currently MySQL allows one to specify what indexes to ignore during
    join optimization. The scope of the current USE/FORCE/IGNORE INDEX 
    statement is only the FROM clause, while all other clauses are not 
    affected.
    
    However, in certain cases, the optimizer
    may incorrectly choose an index for sorting and/or grouping, and
    produce an inefficient query plan.
    
    This task provides the means to specify what indexes are
    ignored/used for what operation in a more fine-grained manner, thus
    making it possible to manually force a better plan. We do this
    by extending the current IGNORE/USE/FORCE INDEX syntax to:
    
    IGNORE/USE/FORCE INDEX [FOR {JOIN | ORDER | GROUP BY}]
    
    so that:
    - if no FOR is specified, the index hint will apply everywhere.
    - if MySQL is started with the compatibility option --old_mode then
      an index hint without a FOR clause works as in 5.0 (i.e, the 
      index will only be ignored for JOINs, but can still be used to
      compute ORDER BY).
    
    See the WL#3527 for further details.
    b9c82eaa
mysqld.cc 294 KB