数据库是第三方的,没有索引,也无法建立索引,怎么查询到想要的数据,数据表内容大致如下:
根据id查询出指定数据,并按照date进行排序desc,
select date,id,index,speed,in from pred_short where rid ='1524E09H2D01525809H2Q00' ORDER BY date limit 0,30;
按照这个sql查出来太慢了,怎么优化?
date id index speend in
20191030000500 1524E09H2D01525809H2Q00 1.0 30.022034 0.0
20191030000500 1524E09H2D01525809H2Q00 1.0 29.012735 0.0
20191030000500 1524E09H2D01525809H2Q00 1.0 29.388569 0.0
20191030000500 1524E09H2D01525809H2Q00 1.0 29.774498 0.0
20191030001000 1524E09H2D01525809H2Q00 1.0 29.793499 0.0
20191030001000 1524E09H2D01525809H2Q00 1.0 29.114473 0.0
20191030001000 1524E09H2D01525809H2Q00 1.0 29.543581 0.0
20191030001000 1524E09H2D01525809H2Q00 1.0 29.859444 0.0
20191030001500 1524E09H2D01525809H2Q00 1.0 29.953201 0.0
20191030001500 1524E09H2D01525809H2Q00 1.0 29.799078 0.0