Here are two queries that return the same resultset, but which is the optimal statement or doesn't it matter?

```
SELECT A.id, B.somefield FROM (
   SELECT id from table1
   UNION
   SELECT id from table2
) A LEFT JOIN table3 B on A.id = B.id

```

or

```
SELECT A.id, B.somefield FROM table1 A LEFT JOIN table3 B on A.id = B.id
UNION
SELECT A.id, B.somefield FROM table2 B LEFT JOIN table3 B on A.id = B.id

```

I realise I could pump them full of data and run some tests, but I am as much interested in the 'why' if one is faster? (I am using postgresql, in case it influences things). 

Thanks.