desc 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 贴出结果
1 SIMPLE b ALL \N \N \N \N 412671 Using temporary; Using filesort 1 SIMPLE a ref rkno,packageno packageno 92 func 1 Using where
1 SIMPLE b ALL \N \N \N \N 412671 Using temporary; Using filesort 1 SIMPLE a ref rkno,packageno packageno 92 func 1 Using where没走到索引 1 SIMPLE b ALL \N \N \N \N 412671 Using temporary; Using filesort
1 SIMPLE b ALL \N \N \N \N 412671 Using temporary; Using filesort 1 SIMPLE a ref rkno,packageno packageno 92 func 1 Using where没走到索引 1 SIMPLE b ALL \N \N \N \N 412671 Using temporary; Using filesort 是的,如何修改sql语句可以使其用到索引?
1 SIMPLE b ALL \N \N \N \N 412671 Using temporary; Using filesort 1 SIMPLE a ref rkno,packageno packageno 92 func 1 Using where没走到索引 1 SIMPLE b ALL \N \N \N \N 412671 Using temporary; Using filesort 是的,如何修改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'你先这样试试 , 不要分组与排序 , 看是什么效果?
你先这样试试 , 不要分组与排序 , 看是什么效果? desc 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'1 SIMPLE b ALL \N \N \N \N 412776 1 SIMPLE a ref rkno,packageno packageno 92 func 1 Using where
贴出结果
1 SIMPLE b ALL \N \N \N \N 412671 Using temporary; Using filesort
1 SIMPLE a ref rkno,packageno packageno 92 func 1 Using where
1 SIMPLE b ALL \N \N \N \N 412671 Using temporary; Using filesort
1 SIMPLE a ref rkno,packageno packageno 92 func 1 Using where没走到索引 1 SIMPLE b ALL \N \N \N \N 412671 Using temporary; Using filesort
1 SIMPLE b ALL \N \N \N \N 412671 Using temporary; Using filesort
1 SIMPLE a ref rkno,packageno packageno 92 func 1 Using where没走到索引 1 SIMPLE b ALL \N \N \N \N 412671 Using temporary; Using filesort
是的,如何修改sql语句可以使其用到索引?
1 SIMPLE b ALL \N \N \N \N 412671 Using temporary; Using filesort
1 SIMPLE a ref rkno,packageno packageno 92 func 1 Using where没走到索引 1 SIMPLE b ALL \N \N \N \N 412671 Using temporary; Using filesort
是的,如何修改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'你先这样试试 , 不要分组与排序 , 看是什么效果?
desc 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'1 SIMPLE b ALL \N \N \N \N 412776
1 SIMPLE a ref rkno,packageno packageno 92 func 1 Using where