Optimization - FROM Clause
Optimization - FROM ClauseSince this clause executes first, it is our first opportunity to narrow down possible record set sizes. This is why I put as many of my ON rules (for joins) as possible in this area as opposed to in the WHERE clause:
This way, by the time we get to the WHERE clause, we will have already excluded rows where is_active and is_viewable do not equal 1.
c.display_status_id = d.id
d.is_active = 1
d.is_viewable = 1
Read more: SQL Query Order of Operations