• Yuchen Pei's avatar
    MDEV-22534 Decorrelate IN subquery · ba9cf8ef
    Yuchen Pei authored
    Transform
    
    in (select inner_col' from inner_table where inner_col = outer_col)
    
    to
    
    , outer_col in (select inner_col', inner_col from inner_table)
    
    Achieved by implementing Item_in_subselect::exists2in_processor(),
    accompanied with comprehensive test coverage.
    
    Caveat:
    
    - The fix of 2nd ps execution segfault requires
      HAVE_PSI_STATEMENT_INTERFACE because it checks
      thd->m_statement_state.m_parent_prepared_stmt to determine whether we
      are inside a ps execution. Is there a better way to determine this?
    - Cannot recognise bad item mismatch in equalities that causes
      materialization to not materialize down the road
    ba9cf8ef
subselect_sj2.result 42.6 KB