In general, no, it does not matter. The optimizer should be able to determine the most efficient table join order, regardless of the order that they display in the query.
It is possible, however, that the order of the tables will affect the query plan. As a rule, this is not so if you have a simple join of two tables, but as the number of tables in a query increases, the number of possible joins grows with a frequency of O (n!). Quite quickly, the optimizer becomes unable to consider all possible join orders, so it needs to use various heuristics to trim the tree. This, in turn, leads to situations where the optimizer selects another driving table if this table is listed first in the SQL expression, and not when this table is the tenth table in the query. Jonathan Lewis has a good blog post showing how the order tables displayed in a query can affect the query plan . If you want to be overly careful, first bringing the table to the driver is a reasonable thing - it will not help very often, but it can sometimes bring some benefit.
Justin cave
source share