Home > Article > Backend Development > sql数据查询优化,该怎么处理
sql数据查询优化
select a.id,rkno,a.packageno as packageno,cust_no,lotno,count(*) as count from `rk_record` as a right join `sys_barcode_1d_y` as b on a.packageno = b.packageno where rkno = '201401030031' group by packageno,lotno order by packageno,lotno asc
rkno,packageno均含索引。
目前查询需要4000多ms,有没有什么方法可以优化该sql语句?