创建一个联合索引,index(user_id,tid)

select * from t_user_info where user_id = '1';

select * from  t_user_info where user_id = '1' and tid =  '1';

select * from  t_user_info where tid ='1' and user_id = '1';

select * from  t_user_info where tid ='1';

最后一种不走索引。

相关文章: