RE: Speed up of Update statement

RE: Speed up of Update statement

 

  

HI

use bulk update for this.
here is some sample code :

DECLARE
TYPE employee_ids_t IS TABLE OF employees.emp_id%TYPE
INDEX BY BINARY_INTEGER;

employee_ids employee_ids_t;
BEGIN
employee_ids(1) := 100;
employee_ids(2) := 101;
employee_ids(3) := 102;

FORALL j IN employee_ids.first..employee_ids.last
UPDATE employees
SET salary = salary*1.1
WHERE emp_id = employee_ids(j);
--COMMIT;
END;
/


Regards
--Deepak Khosla
Rapdigm India ltd

-----Original Message-----
From: Ram Sundar
[mailto:oracledba-ezmlmshield-x28034730.[Email address protected]
Sent: Wednesday, March 29, 2006 12:18 PM
To: LazyDBA Discussion
Subject: Re: Speed up of Update statement


Normally I dont "update 200 million records"

What i do i create a temp table as select <condition> from the table.

Say for example

if i have to update using

update table x set y=y*10

what i do is

Create temp table table1 as select column1, ..., y*10 from x;
And them move the table.

This saves hours of time. Hope this helps.

Best regards
Ram
----- Original Message -----
From: "Rishi Kumar Mishra "
<oracledba-ezmlmshield-x40611120.[Email address protected]
To: "LazyDBA Discussion" <[Email address protected]
Sent: Wednesday, March 29, 2006 11:59 AM
Subject: Speed up of Update statement


>
> Hi All,
>
>
>
> How to speed up the update script (simple update) which deals 200
> million records ,what all we have keep in mind to speed up this huge
> update.
>
> Please help with you expert suggestions.
>
>
>
>
>
> Many Thanks,
>
>
>
> Rishi
>
>
>
> **************** CAUTION - Disclaimer *****************
> This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended
> solely for the use of the addressee(s). If you are not the intended
> recipient, please notify the sender by e-mail and delete the original
> message. Further, you are not to copy, disclose, or distribute this e-mail
> or its contents to any other person and any such actions are unlawful.
> This e-mail may contain viruses. Infosys has taken every reasonable
> precaution to minimize this risk, but is not liable for any damage you may
> sustain as a result of any virus in this e-mail. You should carry out your
> own virus checks before opening the e-mail or attachment. Infosys reserves
> the right to monitor and review the content of all messages sent to or
> from this e-mail address. Messages sent to or from this e-mail address may
> be stored on the Infosys e-mail system.
> ***INFOSYS******** End of Disclaimer ********INFOSYS***
>
>
> --------
> website: http://www.LazyDBA.com
> Please don't reply to RTFM questions
> Oracle documentation is here: http://tahiti.oracle.com
> To unsubscribe: see http://www.lazydba.com/unsubscribe.html
> To subscribe: see http://www.lazydba.com
> By using this list you agree to these
> terms:http://www.lazydba.com/legal.html
>
>


--------
website: http://www.LazyDBA.com
Please don't reply to RTFM questions
Oracle documentation is here: http://tahiti.oracle.com
To unsubscribe: see http://www.lazydba.com/unsubscribe.html
To subscribe: see http://www.lazydba.com
By using this list you agree to these terms:http://www.lazydba.com/legal.html




Confidentiality Notice: This e-mail message is intended only for the personal use of the recipient(s) named above. This message may be an attorney-client communication and as such privileged and confidential. If you are not an intended recipient, you may not review, copy or distribute this message. If you have received this communication in error, please notify us immediately by e-mail and delete the original message.

Oracle LazyDBA home page