Giuseppe Uleri, September 29, 2015 - 9:29 am UTC
Thank you for your answer, please confirm what follows: I was expecting value "4" on the first column because I forgot how null values works, that is applying the filter "after" the join null will be matched against "5" (of course returning false) and therefore excluding the entire row.
Best regards!
September 29, 2015 - 12:52 pm UTC
yes, that is a reasonable statement.
Additional info
Arka, December 22, 2015 - 10:08 am UTC
hi,
I completely agree with the argument provided by connor. However I would like to emphasis that the initial post by guiseppe shows
a join b
which I would read as
a inner join b
, so yes unmatched rows will always be out of the picture.
No need for the where clause.
order of execution
Rakesh, May 13, 2021 - 5:25 am UTC
in above query optimizer 1st execute the where clause or 1st it will join the table ?
May 13, 2021 - 5:12 pm UTC
What happens depends on the join type. Broadly speaking:
- If it's a hash join, the database will filter the rows on each table, then join them
- For nested loops & merge joins, the database can apply both the join and where clause when reading the inner table
The precise details depend on the indexes available, (estimated) number of rows processed, etc.