Performance Difference in comparing integers and comparing strings

前端 未结 4 2200
攒了一身酷
攒了一身酷 2021-02-07 02:24

Can anyone provide any concrete evidence of performance when comparing

int = int

and:

string = string

in

4条回答
  •  灰色年华
    2021-02-07 02:47

    Comparing integers should be faster, at the very low level it will end up with 1 cmp instruction. Comparing string involves more instructions, and as a result, worse performance.
    I assume you either have or don't have indexes on both fields, indexes are equally selective, number of records also the same

提交回复
热议问题