Does the order of tables in a join matter, when LEFT (outer) joins are used?

前端 未结 3 1157
情书的邮戳
情书的邮戳 2020-12-18 01:54

I would like to confirm that the SQL query

SELECT ....
  FROM apples,
       oranges
       LEFT JOIN kiwis ON kiwis.orange_id = oranges.id,
       bananas
          


        
3条回答
  •  清歌不尽
    2020-12-18 02:42

    I've done SQL for donkeys years, and in all my experience, the table order does not matter. The database will look at the query as a whole and create the optimal query plan. That is why database companies employ many people with PhD in query plan optimisations.

    The database vendor would commit commercial suicide if it optimised by the order in which you personally listed the SQL in your query.

提交回复
热议问题