• Sergei Petrunia's avatar
    MDEV-19134: EXISTS() slower if ORDER BY is defined · b1f828a8
    Sergei Petrunia authored
    Step 1: Removal of ORDER BY [LIMIT] from the subquery should be done
    earlier and for broader class of subqueries.
    
    The rewrite was done in Item_in_subselect::select_in_like_transformer(),
    but this had problems:
    - It didn't cover EXISTS subqueries
    - It covered IN-subqueries, but was done after the semi-join transformation
      was considered inapplicable, because ORDER BY was present.
    
    Remaining issue:
    - EXISTS->IN transformation happens before
      check_and_do_in_subquery_rewrites() is called, so it is still prevented
      by the present ORDER BY.
    b1f828a8
subselect_innodb.result 21.4 KB