For efficiency n should be a big as possible, without blowing the RBS.
"The power of instruction is seldom of much efficacy except in those happy dispositions where it is almost superfluous" - Gibbon, quoted by R.P.Feynman
use of cursors for deletion is bad idea.it degrades the performance even more. & more ever u want to commit tran afer 50000 records...that is prone to SNAPSHOT too old as suggested by JMODIC.
i think deletion using rownum & looping is , i can say, better than using cursors.
If number of records in table that needs deletion is more than what it has to retain after deletion than better go for som TEMP table insertion of data that u want to retain.....truncate current table & insert back the records from TEMP table....
Abhay.
funky...
"I Dont Want To Follow A Path, I would Rather Go Where There Is No Path And Leave A Trail."
"Ego is the worst thing many have, try to overcome it & you will be the best, if not good, person on this earth"
My method with a cursor was born of ignorance - I did not know that I shouldn't do it!
BUT experience shows: (a) it is faster (b) it works.
"The power of instruction is seldom of much efficacy except in those happy dispositions where it is almost superfluous" - Gibbon, quoted by R.P.Feynman
Be logical......
SQL Statement will be much faster than PL/SQL block execution...
to tell u...
In our DW prj....we delete about 10 million records a day....and previously the deletion was done using cursors....but it took long...i can say toooo long time to delete....
We then changed the script to wat i suggested in my post....
It was doing much faster than wat it did with Cursors....and mor ever with cursors & commit after 5000 records-snapshot too old errors.....
Abhay.
funky...
"I Dont Want To Follow A Path, I would Rather Go Where There Is No Path And Leave A Trail."
"Ego is the worst thing many have, try to overcome it & you will be the best, if not good, person on this earth"
Originally posted by abhaysk Be logical......
SQL Statement will be much faster than PL/SQL block execution...
I guess my watch must be broken . . . .
"The power of instruction is seldom of much efficacy except in those happy dispositions where it is almost superfluous" - Gibbon, quoted by R.P.Feynman
Originally posted by stmontgo create a new table,
insert as select into the new table from the old,
backup the original table,
drop the original table
rename the new table to the old table,
rebuild indexes grants etc on the new table
rbs is the least of your concerns , mass deletes
can be a serious performance hit as such an action
does no reset the highwater mater and subsequent
scans will scnn up the high water mark even though
those blocks may be empty.
steve
How do I backup the original table? Can you give me a sample code for the above tasks?
Bookmarks