数据库
首页 > 数据库> > Oracle语句联表查询加order by查询速度慢问题优化

Oracle语句联表查询加order by查询速度慢问题优化

作者:互联网

Oracle语句联表查询加order by查询速度慢问题优化

原sql:

select 
...
from T_STUDENT left join T_CLASS on ...
where ...
order by T_STUDENT.LASTDATE,T_STUDENT.NUMBER

耗时约一分钟

修改后:

select 
ROW_NUMBER() OVER(ORDER BY T_STUDENT.LASTDATE,T_STUDENT.NUMBER) NUM,
...
from T_STUDENT left join T_CLASS on ...
where ...

耗时约200ms

标签:...,联表,NUMBER,查询,STUDENT,Oracle,order
来源: https://blog.csdn.net/weixin_44725914/article/details/120429025