大家帮忙优化一下这条oracle语句

wwfgu00ing 2010-12-25 03:01:44
select m.aab01 ,m.aab03 ,m.aab04,
(select aaa02 from aaa_file aa where aa.aaa01=m.aab05) as lb ,
(select suM(to_number(aae12))from aae_file n where n.aae04 = m.aab01 group by aae04) as num,
(select max(aae15) from aae_file n where n.aae04 = m.aab01 ) as price,
(select suM(to_number(aae12)*to_number(aae15))from aae_file n here n.aae04 = m.aab01 group by aae04) as total
from aab_file m order by lb
...全文
74 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
心中的彩虹 2010-12-25
  • 打赏
  • 举报
回复
[Quote=引用楼主 wwfgu00ing 的回复:]
select m.aab01 ,m.aab03 ,m.aab04,
(select aaa02 from aaa_file aa where aa.aaa01=m.aab05) as lb ,
(select suM(to_number(aae12))from aae_file n where n.aae04 = m.aab01 group by aae04) as num,
(selec……
[/Quote]

---b.aae04 = m.aab01 建立联合索引

select m.aab01 ,m.aab03 ,m.aab04,num,price,total,
(case when m.aaa01=m.aab05 then aaa02 end) lb
from aab_file m,
(select suM(to_number(aae12)) num,max(aae15) price,suM(aae12*aae15) total from aae_file group by aae04) b
where b.aae04 = m.aab01






tangren 2010-12-25
  • 打赏
  • 举报
回复
1、先把字段处的语句放在from后来连接吧。看着有点别扭。
2、要优化,按1修改后,贴出执行计划。并说明每个表数据量及索引建立情况。

3,497

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 高级技术相关讨论专区
社区管理员
  • 高级技术社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧