设为首页 - 加入收藏 ASP站长网(Aspzz.Cn)- 科技、建站、经验、云计算、5G、大数据,站长网!
热搜: 创业者 数据 手机
当前位置: 首页 > 站长学院 > MySql教程 > 正文

mysql 字符集造成的功能问题

发布时间:2022-06-29 13:07 所属栏目:115 来源:互联网
导读:
导读:简单的查询,返回同样的,用charge_id去关联,只要0.5s,但如果用order_id要18s! 什么原因? 用order_id时,执行计划是用了Using join buffer (Block Nested Loop);原因查明:把 order_forInit里的order_id字符集是utf8,而 order_item_forInit里的order_id
  简单的查询,返回同样的,用charge_id去关联,只要0.5s,但如果用order_id要18s! 什么原因?
 
  用order_id时,执行计划是用了Using join buffer (Block Nested Loop);原因查明:把 order_forInit里的order_id字符集是utf8,而 order_item_forInit里的order_id字符集是utf8mb4, 不同的字符集造成两个做join时,不能用上索引,会出现“Using join buffer (Block Nested Loop) ”。把 order_forInit里的order_id字符集改成utf8mb4,就没性能问题了!! 不会出现Using join buffer (Block Nested Loop)
 
  explain
 
  select count(*) from
 
  order_forInit a,
 
  --  a.order_id = c.order_id
 
  a.charge_id = c.charge_id
 
  AND c.product_id = d. product_id;

(编辑:ASP站长网)

    网友评论
    推荐文章
      热点阅读