问题: 近日,线上MySQL查出一个慢sql,每次都要查询1000ms以上,严重影响用户体验 今得空去诊断一番,记录如下: sql原句: SELECT r.object_id AS cardId, count(1) AS attachs FROM hzresource_object r LEFT JOIN ( SELECT card_id FROM card_member WHERE user_id = #uid# and card_member.deleted=0 UNION SELECT c…