2

数回実行され、非常に遅い (20 秒以上) 次の更新ステートメントがあります。パフォーマンスを向上させる方法に関する推奨事項はありますか?

    update acc_item 
set means_pay_no = m_pay_no
where acc_item_no in (select distinct(acc.acc_item_no) 
                      from acc_item acc, (select accm.acc_item_no acc1,accm.acc_item_no_2 acc2
                                            from acc_item_match accm,acc_payment_item accp
                                            where accp.acc_payment_no=pay_no
                                            and (accm.acc_item_no = accp.acc_item_no or accm.acc_item_no_2 = accp.acc_item_no))
                      where acc.acc_item_no = acc1
                      or acc.acc_item_no = acc2)                    
and reversed_to_acc_item_no is null;
4

2 に答える 2

1

代わりにこれを試してください:

update acc_item 
set means_pay_no = m_pay_no
where exists (select 1
              from acc_item acc 
              where exists 
               (select 1
                from acc_item_match accm,acc_payment_item accp
                where accp.acc_payment_no=pay_no
                and accp.acc_item_no in (accm.acc_item_no, accm.acc_item_no_2)
                and acc.acc_item_no in (accm.acc_item_no, accm.acc_item_no_2)
                ) and acc.acc_item_no = acc_item.acc_item_no
              )
and reversed_to_acc_item_no is null;
于 2013-08-22T07:50:09.193 に答える