When writing queries, we seem to care less about the performance issue at first. Our first goal is to make the output right. When we get the correct output, we then move on to the next phase we call performance tuning. Today we will try to understand what happens when you write OR in your query. We will do the same thing with UNION ALL and try to understand which one seems to perform better.
Your SQL Server might be facing some performance issues. Let's find out what your SQL Server is going through by thinking like the SQL Server Engine and digging the root cause of the problem.