为何我是用了联合索引后查询速度反而更慢了呢?
有一张数据表,存储大概100w左右的数据。这是sql语句:
select * from data_value where data_point_id ='41607' order by create_time desc limit 0,1;
目前表里只有(除主键外)data_point_id一个索引
explain结果:
查询耗时:
添加联合索引:data_point_id,create_time
alter table data_value add index myindex (data_point_id,create_time)
explain结果:
查询耗时: '0.00032400', 'explain select *from data_value where data_point_id =\'41607\' order by create_time desc limit 0,1'
速度反而下降了好多,这是为何