MySQL byte-for-byte comparison, which is faster? binary vs bin_collate

前端 未结 1 1206
情话喂你
情话喂你 2020-12-19 09:38

Assume we have a table that looks like this:

create table t1(c1 varchar(x)collate utf8mb4_general_ci, index(c1))

To do byte-sensitive compa

相关标签:
1条回答
  • 2020-12-19 10:08

    As you have index in the table,for binary match use binary for constant,not to the column. This will be faster than both of your options.

    select * from t1 where c1 = binary 'test'
    

    Answer to you question is option 1 will be faster where you are doing

    WHERE c1 collate utf8mb4_bin='test'
    
    0 讨论(0)
自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题