Which SQL query is faster? Filter on Join criteria or Where clause?

前端 未结 9 1019
伪装坚强ぢ
伪装坚强ぢ 2020-11-27 03:36

Compare these 2 queries. Is it faster to put the filter on the join criteria or in the WHERE clause. I have always felt that it is faster on the join criteria b

9条回答
  •  北荒
    北荒 (楼主)
    2020-11-27 04:16

    As far as the two methods go.

    • JOIN/ON is for joining tables
    • WHERE is for filtering results

    Whilst you can use them differently it always seems like a smell to me.

    Deal with performance when it is a problem. Then you can look into such "optimisations".

提交回复
热议问题