BETWEEN clause versus <= AND >=

前端 未结 8 1342
無奈伤痛
無奈伤痛 2020-12-14 05:54

Is there a performance difference between using a BETWEEN clause or using <= AND >= comparisons?

i.e. these two queries:

SELECT *  
  FROM table           


        
8条回答
  •  醉酒成梦
    2020-12-14 06:41

    You better check your execution plans because there can be some weird edge cases where BETWEEN can have a different execution plan from the standard >= and <= combination.

    https://blog.pythian.com/oracle-can-between-and-greater-than-or-equal-to-and-less-than-or-equal-to-differ/

    Caveat emptor obviously. But since execution plans can change over time and I really do not have an appetite to test such things, I rather not use BETWEEN at all.

    Sometimes less choice is better.

提交回复
热议问题