SELECT * FROM yw_b2b_gyinfo WHERE info_state <> 0 ORDER BY user_state DESC,info_posttime DESC;
给出这个查询的复合语句能用的.
create index idx1 on `yw_b2b_gyinfo` (info_state,info_title,user_state,info_posttime)
这个不行.就不用发这个了.
给出这个查询的复合语句能用的.
create index idx1 on `yw_b2b_gyinfo` (info_state,info_title,user_state,info_posttime)
这个不行.就不用发这个了.
足矣。前面加上 info_state 反而无效。
因为你的查询是 info_state <> 0 第一个如果是 info_state 的话,该索引无效。