Please have these two types of query in your mind:

```
--query1
Select someFields
From someTables
Where someWhereClues
Union all
Select someFields
FROM some Tables
Where someWhereClues

--query2
Select * FROM (
    Select someFields 
    From someTables
    Union all 
    Select someFields
    FROM someTables
    ) DT
Where someMixedWhereClues

```

> 
> **Note :**  
> 
>  In both queries final result fields are same 
> 
> 
> 

I thought the 1st. query is faster or its performance is better!  

But after some researches I confused by this [note](http://www.codeproject.com/Articles/630346/Understanding-how-SQL-Server-executes%E2%80%8C%E2%80%8B-a-query):

> 
> SQL Server (as a sample of RDBMS) first reads whole data then seek records. => so in both queries all records will read and seek.
> 
> 
> 

Please Help me on my misunderstandings, and on if there is any other differences between query1 and query2 ?

---

**Edit**: adding sample plans:

```
select t.Name, t.type from sys.tables t where t.type = 'U'
union all
select t.Name, t.type from sys.objects t where t.type = 'U'

select * from (
    select t.Name, t.type from sys.tables t
    union all
    select t.Name, t.type from sys.objects t
    ) dt
where dt.type = 'U'

```

Execution Plans are:
![enter image description here](https://i.stack.imgur.com/d8Rr9.png)
![enter image description here](https://i.stack.imgur.com/WV17W.png)

> 
> both are same and **50%**
> 
> 
>