达梦数据库在没有添加order by 之前查询只要半秒,添加order by 后需要4秒时间,添加test_id为索引后速度不变,要如何优化?sql如下:
select id,info_id,test_id,parent_id,createtime,creator,detail from manage_table where status = 1 and year = 2022 order by test_id
你这行SQL已经没有优化的空间了,加了索引还是慢说明你test_id本身也是非重复的,可以考虑试试加上分页