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

前端 未结 8 974
轮回少年
轮回少年 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

    Because more conditions to check is more work for the database engine. Seems logical to me.

    If you were to have one condition over a clustered index field, this particular check wouldn't slow down the operation that much. Have you considered rearranging indexes to match your query?

提交回复
热议问题