日期:2014-05-17  浏览次数:20753 次

oracle 优化方面的问题!!!
2个表都已经有了索引,我想走强制索引,这样的写法对么??各位大侠帮助下啊。
tb_dw_subscriber_his_day表的索引是idx_dw_sub_his_day,
tb_dw_sub_ext_his_day表的索引是idx_dw_sub_ext_subkey,

2个表现在都是百万级用户,后期会有千万级用户,已经有了分区,原来没索引要执行3个小时
现在想加上索引。怎么加呀?还有就是怎样看正确的执行计划呀?

 select /*+ index(tb_dw_subscriber_his_day idx_dw_sub_his_day) parallel(a,4) parallel(b,4) use_hash(a,b)*/
  a.statis_date,
  a.msisdn,
  --nvl(child.parentnumber,a.msisdn),
  a.subscriberkey,
  a.activestop,
  a.activeflag,
  a.subcosid,
  a.languagetype,
  a.suspendstop,
  a.disablestop,
  a.timeenteractive,
  b.servicestatues,
  b.pso,
  b.acctgrpid,
  b.oldmainproudctid,
  a.poolenddate,
  a.deregisterflag,
  a.expiretime,
  a.freezeenddate,
  a.balance,
  a.usernettype,
  b.maxactivedays,
  b.promostarttime,
  b.promoendtime,
  b.promotionplanid,
  a.applytime,
  a.currentstate
   

  from lbidw_airtel.tb_dw_subscriber_his_day a,
  lbidw_airtel.tb_dw_sub_ext_his_day b


  where a.subscriberkey = b.subscriberkey
  and a.statis_date=20120612
  and b.statis_date=20120612
  ;

------解决方案--------------------
"正确的执行计划"??,分析一下表,再看执行计划。oracle那个版本的?是不是硬件跟不上了。
sql执行时监测一下系统资源。
------解决方案--------------------
百万的表分析一下很快的把。 。。