EXPLAIN EXTENDED SELECT
COUNT(DISTINCT friend.id_)
FROM
ftsp_kh_khxx khxx
JOIN
ftsp_kh_pg pg ON pg.kh_khxx_id_ = khxx.id_
JOIN
ftsp_infra_user u ON u.id_ = pg.infra_user_id_
AND u.is_delete_ = '0'
JOIN
ftsp_zj_bmyh bmyh ON bmyh.infra_user_id_ = u.id_
AND bmyh.is_delete_ = '0'
JOIN
ftsp_zj_bmxx bmxx ON bmyh.zj_bmxx_id_ = bmxx.id_
AND bmxx.is_delete_ = '0'
JOIN
ftsp_wechat_friend friend ON u.work_weixin_id_ = friend.infra_user_wxid_
AND friend.source_ = '2'
AND friend.is_delete_ = '0'
LEFT JOIN
ftsp_wechat_kh_relation relation ON relation.kh_khxx_id_ = khxx.id_
AND relation.type_ = '1'
AND friend.wxid_ = relation.wxid_
WHERE
bmyh.is_active_ = '1'
AND bmxx.id_ IN ('6C1C102CA0CC4C21A0769899FEADD207' , '320087F31E5F4E6BB6569534F59B551E', ...)
AND bmxx.zj_zjxx_id_ = 'AA4356930FCF4456B63BC1EF0E63BF40'
AND khxx.zj_zjxx_id_ = 'AA4356930FCF4456B63BC1EF0E63BF40'
AND EXISTS( SELECT
1
FROM
ftsp_wechat_kh_relation re
JOIN
ftsp_kh_khxx kh ON re.kh_khxx_id_ = kh.id_
WHERE
re.type_ = '1'
AND re.wxid_ = friend.wxid_
AND kh.name_ LIKE CONCAT('%', 'XXXXX', '%'))
AND khxx.zj_zjxx_id_ = 'AA4356930FCF4456B63BC1EF0E63BF40';
创建 Outline 绑定执行计划:
CREATE OUTLINE my_outline ON
SELECT
COUNT(DISTINCT friend.id_)
FROM
ftsp_kh_khxx khxx
JOIN
ftsp_kh_pg pg ON pg.kh_khxx_id_ = khxx.id_
JOIN
ftsp_infra_user u ON u.id_ = pg.infra_user_id_
AND u.is_delete_ = '0'
JOIN
ftsp_zj_bmyh bmyh ON bmyh.infra_user_id_ = u.id_
AND bmyh.is_delete_ = '0'
JOIN
ftsp_zj_bmxx bmxx ON bmyh.zj_bmxx_id_ = bmxx.id_
AND bmxx.is_delete_ = '0'
JOIN
ftsp_wechat_friend friend ON u.work_weixin_id_ = friend.infra_user_wxid_
AND friend.source_ = '2'
AND friend.is_delete_ = '0'
LEFT JOIN
ftsp_wechat_kh_relation relation ON relation.kh_khxx_id_ = khxx.id_
AND relation.type_ = '1'
AND friend.wxid_ = relation.wxid_
WHERE
bmyh.is_active_ = '1'
AND bmxx.id_ IN ('6C1C102CA0CC4C21A0769899FEADD207' , '320087F31E5F4E6BB6569534F59B551E', ...)
AND bmxx.zj_zjxx_id_ = 'AA4356930FCF4456B63BC1EF0E63BF40'
AND khxx.zj_zjxx_id_ = 'AA4356930FCF4456B63BC1EF0E63BF40'
AND EXISTS( SELECT
1
FROM
ftsp_wechat_kh_relation re
JOIN
ftsp_kh_khxx kh ON re.kh_khxx_id_ = kh.id_
WHERE
re.type_ = '1'
AND re.wxid_ = friend.wxid_
AND kh.name_ LIKE CONCAT('%', 'XXXXX', '%'))
AND khxx.zj_zjxx_id_ = 'AA4356930FCF4456B63BC1EF0E63BF40'
WITH (outline = '/*+ use_hash(bmyh) use_hash(friend) use_hash(pg) */');
1、服务器配置是有区别的,但是这个服务器的配置并不是特别差的,另外后续我们也会升级ob的版本规避这个问题(这个服务器之前部署4.2.5确认没有这个问题,但是由于一些bugs问题,不得不重新初始化到4.2.1的版本);
2、4.2.3的obdiag gather scene run 结果: obdiag_gather_pack_20241115170305.tar.gz (145.9 KB)