IN Subquery Optimization
Problem Definition
An IN subquery is a type of subquery that takes the following form.
(expr1, expr2...) [NOT] IN (SELECT expr3, expr4, ...)
An IN subquery can be rewritten as an equivalent correlated EXISTS subquery or inner join, which can create a extra filtering condition. If the filtering condition has an appropriate index or is recommended by the PawSQL index recommendation engine, better performance can be achieved.
- IN Subquery to EXISTS conversion