I have a table with a typical unsigned id
select * from log_data where id between -129 and -120
seems to be trying to return every row in the table (or at least fixes on βsending dataβ for hours)
id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE log_data ALL PRIMARY NULL NULL NULL 357114 Using where
According to the docs on BETWEEN
at https://dev.mysql.com/doc/refman/5.0/en/comparison-operators.html#operator_between : This is equivalent to the expression (min <= expr AND expr <= max) if all arguments of the same type
but
select * from log_data where -129 <= id and id <= -120
behaves as I expected.
id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Is this a mistake or is this behavior explained?
source share