The following is an example that shows a SQL statement with an EXISTS subquery. The SQL counts the records from the EMPLOYEE table if the OR conditions are satisfied in the subquery of the DEPARTMENT table.
select countn(*) from employee a where
exists (select 'x' from department b
Here the following is the query plan in the Tosska proprietary tree format, it takes 4 minutes and 29 seconds to...
How to Tune SQL Statement with OR conditions in a Subquery for SQL Server?
select countn(*) from employee a where
exists (select 'x' from department b
where a.emp_id=b.dpt_manager or a.emp_salary=b.dpt_avg_salary)
Here the following is the query plan in the Tosska proprietary tree format, it takes 4 minutes and 29 seconds to...
How to Tune SQL Statement with OR conditions in a Subquery for SQL Server?