软件开发数据库

DB2不走索引

建了个索引select pk_corp_in from scss_transbill 时能使用到这个索引但是下面这句查询却不走索引select sum (coalesce (b.nnum, 0)) from scss_transbill a left outer join scss_transbill_b b on a.pk_transbill = b.pk_transbill where a.pk_corp_in = '1001' and ...显示全部
建了个索引

select pk_corp_in from scss_transbill 时能使用到这个索引

但是下面这句查询却不走索引
select sum (coalesce (b.nnum, 0)) from scss_transbill a left outer join scss_transbill_b b on a.pk_transbill = b.pk_transbill where a.pk_corp_in = '1001' and a.cincalbodyid = '1001A110000000000335' and b.cinwarehouseid = '1001A110000000000O22' and b.cinventoryid = '0001A110000000022CYG' and b.pk_pattern = '0001A110000000022JJZ' and b.dplanarrvdate >= '2011-08-16' and b.dplanarrvdate <= '2011-09-15' and a.vbillstatus <> 1 and coalesce (b.dr, 0) = 0 with ur
这是为神马!!!!!!求高手解释收起
参与5

查看其它 3 个回答wgarnett的回答

wgarnettwgarnett售后工程师nys
最终没有用到你的索引
IT分销/经销 · 2011-09-28
浏览1340

回答者

wgarnett
售后工程师nys

wgarnett 最近回答过的问题

回答状态

  • 发布时间:2011-09-28
  • 关注会员:1 人
  • 回答浏览:1340
  • X社区推广