一个千万级的表查询,表tableName,字段为 id, gpstime,tID,type.........其中ID为自增长主键。已经建立索引create index myTest on tableName(gpstime,tID); 其中tID为用户ID,gpstime为时间,用户每隔1分钟就会增加一条记录。
查询语句 为select   gepstim,tID,type from  tableName where gpstime<?? and gpstime>??? and tID in(?????) and type>-1 ;我查询20个tID的一个月的数据,查询起来耗时30秒,请教大虾们,如何优化啊?