mysql 优化

  1. 用 join 代替子查询
    子查询
 select distinct(value) from tableName where name='minor_version' 
and custins_id in (select id from tableName2 where parent_id=%s); 

join

select distinct(value) from tableName as t1
join tableName2 as t2 on t1.custins_id = t2.id
where t1.name='minor_version' and t2.parent_id=%s

你可能感兴趣的:(mysql 优化)