WHERE stmt params的顺序会影响sqlite的性能吗?

时间:2017-08-22 13:37:06

标签: sqlite

我在sqlite数据库中有一个查询,如下所示:

select from table where
   (a = 20 and b = 5 and c > 40) or
   (a = 20 and b > 5) or
   (a > 20) 
   order by a, b, c asc;

如果选择的顺序改变为此,是否会有任何性能差异?:

select from table where
   (a > 20) or
   (a = 20 and b > 5) or
   (a = 20 and b = 5 and c > 40)
   order by a, b, c asc;

由于

1 个答案:

答案 0 :(得分:0)

query planner将始终尝试重新排序字词。因此,如何在查询中编写它们并不重要。