explain select * from verify_anti_fraud where user_key='51d41b2c7636c4906151ec67de36e927' order by create_time desc limit 100 ;
上面sql,这两个字段,都没加索引的时候,结果如下:
添加如下索引:
alter table verify_anti_fraud add index inx_user_key(user_key,create_time);
再次执行:
explain select * from verify_anti_fraud where user_key='51d41b2c7636c4906151ec67de36e927' order by create_time desc limit 100 ;
适当的添加索引可以去掉filesort