orcle 查询语句 速度很慢

来源:百度知道 编辑:UC知道 时间:2024/06/07 11:44:48
select a.section_no dept,c.name deptname,sum(a.sales_cost) cost_nv,sum(round(a.sales_cost*(1+d.perc/100),2)) cost
from account a,items b,store_sections c,vat d where b.sell_vat=d.vat_no and a.item_no=b.item_no and
a.section_no=c.section_no and a.store_no=c.store_no and a.store_no='002'
and a.work_date>=to_date('20071229','yyyymmdd') and a.work_date<=to_date('20080128','yyyymmdd')
group by a.section_no,c.name order by a.section_no
各位达人帮我看一下上面的语句 查询速度很慢有 谁可以帮我该改一下啊!给分的

检查索引

把条件里最精确的往后放,比如
a.store_no='002' 把他放到where的最后面。

还有,看看你的索建的好不好

应该是没用上索引吧,你F5看执行计划,把数据量大的放在第一位,作为基础表