Why do multiple WHERE conditions slow query rather than speed it up?

前端 未结 8 961
轮回少年
轮回少年 2021-02-04 04:35

The problem is that the query in question runs very slow when compared to the query run with one or two, rather than all three of its conditions.

Now the query.

8条回答
  •  深忆病人
    2021-02-04 05:27

    Data transportation wise, you are correct in your thinking: less data, quicker completion time. However, usually that time is minimal, and most of the time is spent on the actual query processing.

    Look at it this way: If you were in a car lot, would it be easier to pick out all cars that were red, or all cars that were red, model year 2006, black interior, and had rubber floor mats?

提交回复
热议问题