简体   繁体   中英

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

例如:如果有两个WHERE子句:WHERE stringA =“ value” 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM