What's mysql's “BETWEEN” performance over..?

后端 未结 4 1060
一生所求
一生所求 2020-12-03 06:38

Is there any better performance when querying in (particularly) mysql of the following:

SELECT * FROM `table` WHERE `unix_date` BETWEEN 1291736700 AND 129173         


        
4条回答
  •  庸人自扰
    2020-12-03 07:02

    From the documentation:

    • expr BETWEEN min AND max

    If expr is greater than or equal to min and expr is less than or equal to max, BETWEEN returns 1, otherwise it returns 0. This is equivalent to the expression (min <= expr AND expr <= max) if all the arguments are of the same type. Otherwise type conversion takes place according to the rules described in Section 11.2, “Type Conversion in Expression Evaluation”, but applied to all the three arguments.

    So it really is just syntax sugar.

提交回复
热议问题