SELECT t.val, m.username FROM  test.tmp_table AS t LEFT JOIN cehome.uc_members AS m USE INDEX(`mobile`) ON t.val=m.mobile 

 

上面的left join  uc_members表的mobile字段没有用到索引,是因为uc_members表的 ENGINE=MyISAM DEFAULT CHARSET=gbk 和 tmp_table表类型的表编码不一致

 

最好两个表的类型和编码要一致,连接的两个字段的类型也要一致,这样索引才生效。

相关文章:

  • 2021-11-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-06
  • 2022-12-23
  • 2021-10-07
  • 2022-12-23
猜你喜欢
  • 2021-12-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-19
  • 2022-12-23
相关资源
相似解决方案