The question of whether the fields in mysql sql are calculated or not.

Field id is of type int

select * from table where id="1";
select * from table where id=1;

Is there any difference in execution efficiency between the two statements? Is the first line id calculated?

I seem to be the same through explain, but why is there a statement similar to the first line in the slow query? In addition, there are some sql in the slow query through the explain test type is ref, scan lines are not many, and so on, but also used the index, why is it still a slow query?

Mar.05,2021

there is a process of implicit type conversion, which of course consumes computation.
MySQL:: MySQL 5.7 Reference Manual:: 12.2 Type Conversion in Expression Evaluation: https://dev.mysql.com/doc/ref.

Menu