开发者

Does the order of the fields in the WHERE clause affect the performance?

开发者 https://www.devze.com 2023-01-05 02:03 出处:网络
for example: if there are two WHERE clause: WHERE stringA=\"va开发者_如何学编程lue\" AND intB=1.In a simple query like that, no. MySQL will attempt to process the most restrictive filters in priority

for example: if there are two WHERE clause: WHERE stringA="va开发者_如何学编程lue" AND intB=1.


In a simple query like that, no. MySQL will attempt to process the most restrictive filters in priority order, taking any indexes into account.

When you get into complex queries that joins or nested selects, there can be a real art to how you place the query conditions to best restrict the number of rows that need to be joined.

0

精彩评论

暂无评论...
验证码 换一张
取 消