Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Can someone please help "tune" this script?
Andy wrote:
>
> I am trying to do what I think is a common thing. I need to
> update one table from the values in another table based upon the
> join of a few columns. Below is the script that I am running,
> but it seems to run forever. The table that I am updating
> (frt.freight) has about 200,000 rows and the table with the
> values that I am using for the update (frt.mpay_working) has
> about 2,000 rows. Can this be made to run faster? Thanks alot
> for your help...I appreciate it!
> Andy
> Update frt.freight a
> set (charged$, remit, batch, paid_weight, audit_reason_code)
> = (select b.charged$, b.remit, b.batch, b.paid_weight,
> b.audit_reason_code
> from frt.mpay_working b
> where b.pro = a.pro and
> b.frt_order = a.frt_order and
> b.accessorial_rc = a.accessorial_rc and
> b.carrier = a.carrier and
> b.bl = a.bl);
>
> * Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
> The fastest and easiest way to search and participate in Usenet - Free!
You're updating every row in the table since you have not got a where clause on the main update. Alternatively, if the tables both have the appropriate primary key you can update the join query directly.
HTH
-- =========================================== Connor McDonald http://www.oracledba.co.uk We are born naked, wet and hungry...then things get worseReceived on Fri Apr 14 2000 - 00:00:00 CDT