• mhansson/martin@linux-st28.site's avatar
    Bug#30665: Inconsistent optimization of IGNORE INDEX FOR {ORDER BY|GROUP BY} · ab73b25d
    mhansson/martin@linux-st28.site authored
    The optimizer takes different execution paths during EXPLAIN than SELECT,
    this fix relates only to EXPLAIN, hence no behavior changes.
    The test of sort keys for ORDER BY was prohibited from considering keys
    that were mentioned in IGNORE KEYS FOR ORDER BY. This led to two 
    inconsistencies: One was that IGNORE INDEX FOR GROUP BY and 
    IGNORE INDEX FOR ORDER BY gave apparently different EXPLAINs; the latter 
    erroneously claimed to do filesort. The second inconsistency 
    is that the test of sort keys is called twice, finding a sort key the first
    time but not the second time, leading to the mentioned filesort.
    
    Fixed by making the test of sort keys consider all enabled 
    keys on the table. This test rejects keys that are not covering, and for 
    covering keys the hint should be ignored anyway. 
    ab73b25d
group_by.result 43.7 KB