执行计划问题

[复制链接]
查看11 | 回复1 | 2008-10-24 13:23:42 | 显示全部楼层 |阅读模式
代码中,去掉括号不会全表扫描,走索引.加括号 不走索引,全表扫描,走netedloop. 加hint /* use_hash */ 和去掉括号一样,走索引,走hash
bug ?
select *
from (select tblha0_.ID
as ID13_,

tblha0_.INIT_ID as INIT2_13_,

tblha0_.RECORD_DATE as RECORD3_13_,

tblha0_.SRQYas SRQY13_,

tblha0_.CRJ as CRJ13_,

tblha0_.DRQYas DRQY13_,

tblha0_.ZYJ as ZYJ13_,

tblha0_.DRDWFSas DRDWFS13_,

tblha0_.DRDWJZas DRDWJZ13_,

tblha0_.DRDWCJas DRDWCJ13_,

tblha0_.LJDWJZas LJDWJZ13_,

tblha0_.LJSYL as LJSYL13_,

tblha0_.ZYJBD as ZYJBD13_,

tblha0_.CJJEas CJJE13_,

tblha0_.LJYKE as LJYKE13_,

tblha0_.YYB as YYB13_,

tblha0_.FXL as FXL13_,

tblha0_.SXF as SXF13_,

tblha0_.LCSXF as LCSXF13_,

tblha0_.DSYKas DSYK13_,

tblha0_.KYZJas KYZJ13_,

tblha0_.BZJ as BZJ13_,

tblha0_.FDYKas FDYK13_,

tblha0_.ZJBZJ as ZJBZJ13_,

tblha0_.JYSFXLas JYSFXL13_,

tblha0_.JYSBZJas JYSBZJ13_,

tblha0_.LJBJas LJBJ13_,

tblha0_.CJ
as CJ13_,

tblha0_.RJ
as RJ13_,

tblha0_.DRLJDWCJas DRLJDWCJ13_,

tblha0_.ADD_NUM as ADD31_13_,

tblha0_.LJCJJEas LJCJJE13_,

tblha0_.LJCRJ as LJCRJ13_

from KIIIK.TB_LH_A tblha0_, KIIIK.TB_LH_INIT tblhinit1_
where tblha0_.INIT_ID = tblhinit1_.ID
and tblha0_.RECORD_DATE = :1
and tblhinit1_.MILITARY_SERVICE = :2
and ( tblha0_.LJYKE is not null ) -- 此处加括号执行计划不同.
order by tblha0_.LJYKE desc)
where rownum <= :3
[ 本帖最后由 ouyangzi 于 2010-2-5 15:03 编辑 ]
回复

使用道具 举报

千问 | 2008-10-24 13:23:42 | 显示全部楼层
给列加个not null约束
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行