Mysql performance optimization: Like query using index

EXPLAIN SELECT *FROM hb_send_list WHERE hongbao_id LIKE ‘%AA1317B32755BDFC1B8036’
Insert picture description here
EXPLAIN SELECT *FROM hb_send_list WHERE hongbao_id LIKE ‘AA1317B32755BDFC1B8036%’
Insert picture description here
EXPLAIN SELECT *FROM hb_send_list WHERE hongbao_id LIKE ‘A%A1317B32755BDFC1B8036’
Insert picture description here

mysql is using like query,% will not use index in the front, index will be used in the middle or last, but the number of rows scanned in the front is more

Original link: https://blog.csdn.net/lihuang319/article/details/79985394

Guess you like

Origin blog.csdn.net/qq_43518425/article/details/113875792