在一个表上有2个联合索引y(a,b,c),x(a,c) 我查询的时候 select * from table where a=1201 order by c desc limit 20 的时候用explain查看,发现mysql用的是y索引 这样我在extra里看到有filesort,而不是我想要的x索引,这个怎么办?怎么才能用到我的x索引 select * from table FORCE INDEX (x) where a=1201 order by c desc limit 20
CREATE PROCEDURE A() BEGIN DECLARE 'Constraint Violation' CONDITION FOR sqlexception; DECLARE EXIT HANDLER FOR 'Constraint Violation' ROLLBACK; BEGIN TRAN ......