Performance difference if I UNION first, then put WHERE on unioned result set?

Posted by Dennis on Stack Overflow See other posts from Stack Overflow or by Dennis
Published on 2010-05-11T22:09:56Z Indexed on 2010/05/11 22:14 UTC
Read the original article Hit count: 304

Filed under:
|
|

In Microsoft SQL, is there any difference in performance between this:

SELECT columns FROM table1 WHERE cond
UNION
SELECT columns FROM table2 WHERE cond

and this:

SELECT columns FROM
(
SELECT columns FROM table1
UNION
SELECT columns FROM table2
) WHERE cond

?

© Stack Overflow or respective owner

Related posts about sql

Related posts about tsql