Update Statement [message #607172] |
Mon, 03 February 2014 07:35 |
srinivas.k2005
Messages: 404 Registered: August 2006
|
Senior Member |
|
|
Hi,
The table "RIT" has around 300 million records.
I need to add the new column to "RIT" table and update the column with sequence.
I planned to use below approach. But since there are millions of records, any suggestions on how to update??
TABLE "RIT" :
a NUMBER
b Varchar2(20)
c DATE
Adding new column,
ALTER TABLE RIT
ADD RIT_ID_SEQ NUMBER
/
CREATE SEQUENCE RIT_IDENTIFIER_SEQ
MINVALUE 1
MAXVALUE 999999999999999999999999999
START WITH 1001
INCREMENT BY 1
CACHE 20000
/
UPDATE /*+ PARALLEL (rt,16) */ RIT rt
SET rt.RIT_ID_SEQ=RIT_IDENTIFIER_SEQ.nextval;
COMMIT;
Regards,
SRK
|
|
|
|
|
|
|
|
|
Re: Update Statement [message #607186 is a reply to message #607182] |
Mon, 03 February 2014 09:10 |
srinivas.k2005
Messages: 404 Registered: August 2006
|
Senior Member |
|
|
Thanks for your input.
But I have created new table and inserted 300 million records into it from other table.
So nobody will be accessing the new table.
Regards,
SRK
|
|
|
Re: Update Statement [message #607187 is a reply to message #607176] |
Mon, 03 February 2014 09:13 |
John Watson
Messages: 8931 Registered: January 2010 Location: Global Village
|
Senior Member |
|
|
srinivas.k2005 wrote on Mon, 03 February 2014 14:00I have given the update statement. It is still running from past 4 hours now.
Any suggestions OR other Methods ?? You have started the job already? So why did you ask for advice on how to do it??
If you want to track it's progress, query v$session_longops. And to see why the session is waiting:
select event,seconds_in_wait from v$session where...
--update: you could also query v$transaction, to see how much undo is being generated.
[Updated on: Mon, 03 February 2014 09:13] Report message to a moderator
|
|
|
|
Re: Update Statement [message #607194 is a reply to message #607172] |
Mon, 03 February 2014 12:04 |
Solomon Yakobson
Messages: 3273 Registered: January 2010 Location: Connecticut, USA
|
Senior Member |
|
|
Using sequence in update will slow you down. Use ROWNUM instead:
UPDATE RIT rt
SET rt.RIT_ID_SEQ = 1000 + ROWNUM
/
CREATE SEQUENCE RIT_IDENTIFIER_SEQ
MINVALUE 1
MAXVALUE 999999999999999999999999999
START WITH 1001 + table RIT row count
INCREMENT BY 1
CACHE 20000
/
SY.
|
|
|
|