数据库表结构
id(int) name(varchar 50) state(int)id为自增,name为32位字符串,state为int,值的范围为0 1 2 3 该表大量数据的state为0现在需要频繁查询state不为0的数据where state<>0 and name="ABCDEFRG....."请问这种情况下,如何优化查询速度?
另 对mysql版本有没有最低要求?
谢谢
id(int) name(varchar 50) state(int)id为自增,name为32位字符串,state为int,值的范围为0 1 2 3 该表大量数据的state为0现在需要频繁查询state不为0的数据where state<>0 and name="ABCDEFRG....."请问这种情况下,如何优化查询速度?
另 对mysql版本有没有最低要求?
谢谢
如果state的状态 后续会从非0 update成0,对性能有影响吗?
在MySQL中超频繁最好这样,如果能保证连接不会断开,最好是 temporary table engine=memory
==>
where state>0 and name="ABCDEFRG....."索引照常用.