-
I have to do number of updates on a table which has million records.
eg.
Update mwebMatrix
Set Mat_Approved = 10
Where Mat_Category in(1,3) ;
commit;
If I do this, it takes hours and nothing happens.
So I broke these statements in small parts..
Update mwebMatrix
Set Mat_Approved = 10
Where Mat_Category = 3 and mat_id between 1 and 250000;
commit;
Update mwebMatrix
Set Mat_Approved = 10
Where Mat_Category = 3 and mat_id between 250001 and 350000;
commit;
Update mwebMatrix
Set Mat_Approved = 10
Where Mat_Category = 3 and mat_id between 350001 and 450000;
commit;
Even these once are taking a long time.. and I don't know if anything is getting updated or not..
I can't do select count(*).. either.
Is there any faster way to do this.
How about a cursor with loop and commits for a batch or do you think that will be bad ?
Can I use ROWNUM function to do the batch updates, like in thread:
http://www.dbasupport.com/forums/sho...0&pagenumber=2
thanks for help
Sonali
Sonali
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|