oracle 语句优化问题select nvl(sum(a.sl),0),nvl(sum(a.je),0)from tablea aleft join tableb bon a.zd = b.zdwhere a.zd2 in ('181','180','179','178','177','176','175')and nvl(b.zd3,'xx') = 'xx'类似这样的语句 zd、zd2是字段 都有索引在p
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/22 22:50:24
oracle 语句优化问题select nvl(sum(a.sl),0),nvl(sum(a.je),0)from tablea aleft join tableb bon a.zd = b.zdwhere a.zd2 in ('181','180','179','178','177','176','175')and nvl(b.zd3,'xx') = 'xx'类似这样的语句 zd、zd2是字段 都有索引在p
oracle 语句优化问题
select nvl(sum(a.sl),0),nvl(sum(a.je),0)
from tablea a
left join tableb b
on a.zd = b.zd
where a.zd2 in ('181','180','179','178','177','176','175')
and nvl(b.zd3,'xx') = 'xx'
类似这样的语句 zd、zd2是字段 都有索引
在plsql的解释计划里看 耗费、基数都很小 但是查询速度极慢
我不是知道不是没走zd2 zd3 自己的索引.
有没有什么优化方法 实在太慢了
oracle 语句优化问题select nvl(sum(a.sl),0),nvl(sum(a.je),0)from tablea aleft join tableb bon a.zd = b.zdwhere a.zd2 in ('181','180','179','178','177','176','175')and nvl(b.zd3,'xx') = 'xx'类似这样的语句 zd、zd2是字段 都有索引在p
把 nvl(b.zd3, 'xx') = 'xx' 改为 and ( b.zd3='xx' or b.zd3 is null )
这样就走zd3的索引了,先处理左边的话就不走zd3的索引了