update user_score set score=(score+5)
where acc_nbr in (select calling_nbr from tb_up50_call where calling_nbr!=called_nbr
 group by calling_nbr);是score=(score+5)计算,和acc_nbr in还有group by 的问题么?
谢谢解答!

解决方案 »

  1.   

    user_score:acc_nbr
    tb_up50_call:calling_nbr上建立索引没有
      

  2.   

    如果你的tb_up50_call表数据很大的话,calling_nbr!=called_nbr可能就有问题了。。
    当然这的group by可以换成Distinct试试
      

  3.   

    user_score表的acc_nbr建立主键索引,tb_up50_call建立普通索引了。
      

  4.   

    update user_score ,(select calling_nbr from tb_up50_call where calling_nbr!=called_nbr) b
    set score=(score+5)
    where acc_nbr=calling_nbr
      

  5.   

    --如果索引都加了,用exists效率应该会高些
    update user_score set score=(score+5)
    where acc_nbr exists (select calling_nbr from tb_up50_call where calling_nbr!=called_nbr
     group by calling_nbr);
      

  6.   

    这个方法好 ,非常感谢,1min多钟出结果了
      

  7.   

    这个方法好 ,非常感谢,1min多钟出结果了。
    上面引用错了
      

  8.   

    这个方法更给力只用13sec,不过要修改一下
    update user_score set score=(score+5)
    where exists (select calling_nbr from tb_up50_call where calling_nbr!=called_nbr
     acc_nbr=calling_nbr);