12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
ADADADADAD
mysql数据库 时间:2024-12-24 19:12:18
作者:文/会员上传
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
简单的查询,返回同样的,用charge_id去关联,只要0.5s,但如果用order_id要18s! 什么原因?用order_id时,执行计划是用了Using join buffer (Block Nested Loop);原因查明:把order_forIn
以下为本文的正文内容,内容仅供参考!本站为公益性网站,复制本文以及下载DOC文档全部免费。
简单的查询,返回同样的,用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,
order_item_forInit c,
product d
WHERE
-- a.order_id = c.order_id
a.charge_id = c.charge_id
AND c.product_id = d.product_id;
附录:
mysql字符集 utf8 和utf8mb4 的区别: https://blog.csdn.net/qq_37054881/article/details/90023611
11-20
11-19
11-20
11-20
11-20
11-19
11-20
11-20
11-19
11-20
11-19
11-19
11-19
11-19
11-19
11-19