Deleteing large number of rows_urgent

Hi Friends,
I need to write a procedure which will purge a table having more than 8 crores records based on the parameter passed by the user.We have open a cursor and in loop we are deleting one by one and when the count reaches 50,000 we issue commit so the rollback segment problem can be avoided.But this is taking plenty of time...very very slow.Is there any other way through which we can improve the perfomance.Instead of deleting one by one is it possible to delete 20000 rows in a fetch.
Please suggest.

try BULK COLLECT method of pl/sql.
it has the option for you to process a set of records with a single execution.
here is an example.
declare
type ty_dept is table of number index by binary_integer;
dept_list ty_dept;
cursor cur_dept is select deptno from dept;
begin
open cur_dept;
loop
--do bulk collect 1000 at a time
fetch cur_dept bulk collect into dept_list limit 1000;
exit when cur_dept%notfound;
--process in bulk
forall i in 1..dept_list.count
delete from emp where deptno = dept_list(i);
end loop;
end;
in the above example it process 1000 at a time. so instead of looping 1000 times and execute delete statements 1000 times it does once.
maybe this should improve you performance.
bench mark with initial some set of records before applying for entire 8 crores.

Similar Messages

  • Best way to delete large number of records but not interfere with tlog backups on a schedule

    Ive inherited a system with multiple databases and there are db and tlog backups that run on schedules.  There is a list of tables that need a lot of records purged from them.  What would be a good approach to use for deleting the old records?
    Ive been digging through old posts, reading best practices etc, but still not sure the best way to attack it.
    Approach #1
    A one-time delete that did everything.  Delete all the old records, in batches of say 50,000 at a time.
    After each run through all the tables for that DB, execute a tlog backup.
    Approach #2
    Create a job that does a similar process as above, except dont loop.  Only do the batch once.  Have the job scheduled to start say on the half hour, assuming the tlog backups run every hour.
    Note:
    Some of these (well, most) are going to have relations on them.

    Hi shiftbit,
    According to your description, in my opinion, the type of this question is changed to discussion. It will be better and 
    more experts will focus on this issue and assist you. When delete large number of records from tables, you can use bulk deletions that it would not make the transaction log growing and runing out of disk space. You can
    take the table offline for maintenance, a complete reorganization is always best because it does the delete and places the table back into a pristine state. 
    For more information about deleting a large number of records without affecting the transaction log.
    http://www.virtualobjectives.com.au/sqlserver/deleting_records_from_a_large_table.htm
    Hope it can help.
    Regards,
    Sofiya Li
    Sofiya Li
    TechNet Community Support

  • How do I delete large number of email messages?

    I get a large number of emails. Is there a way to select them on my iPod Touch 32g in groups rather than one at a time when I delete many messages?

    Did you ever find a solution to this?
    I, too, would like to DELETE lots of emails at the same time, even ALL of my old emails, without having to use EDIT, then touching each email one at a time, then selecting DELETE. Painfully slow if you have 200+ emails ... this should take 5 seconds, not 10 minutes.

  • How do I delete large number of duplicates on my Itunes w/o Ctrl+Click

    I have a large number of duplicates that were loaded onto my ITunes and I would like to delete them. So far the only way I have found is to go down the list one at a time and Ctrl+Click and then delete. Since Itunes can designate duplicates, is there a function for removing all the duplicates before I synch my ipod???
      Windows XP  

    Itunes can't mass delete duplicates, but one of the forum member has written a script to do it, see:
    http://home.comcast.net/~teridon73/itunesscripts/
    If you prefer to go commercial take a look at iTsync
    http://www.itsyncsoftware.com/itsync.htm

  • Delete large number of accounts from GL master

    Hello All:
       Doing a large amount of Account deletion. There is no DI support on the topic, so I was trying to use UI on form 750.
    I tried both method of either using the find button and then delete or search through matrix. -> click on the row to bring up the accounts and then activatemanul
       I am having problem for some reason, that after certain number of record found. The delete manual 5910 no longer works. It doesn't sent out exception nor does it do anything. If you try to manually do it it will still work. But I suppose just the progarm runs so fast that it can not catch up?
       I don't know if anyone has a better solution because I have tried several ways with no improvement. It sill locate the record fine, but wouldn't delete the accounts.It just go to the next record without doing anything!
    for (int i = 0; i < Global.orecord.RecordCount; i++)
                            Global.formatcode = Global.orecord.Fields.Item("formatcode").Value.ToString();
                            Global.omatrix = (SAPbouiCOM.Matrix)(Global.oform.Items.Item("3").Specific);
                            for (int i2 = lastnum; i2 <= Global.omatrix.RowCount; i2++)
                                Global.oedit = (SAPbouiCOM.EditText)(Global.omatrix.Columns.Item("1").Cells.Item(lastnum + 1).Specific);
                                formatcode1 = Global.oedit.Value.ToString();
                                if (formatcode1.IndexOf(" - ") != -1)
                                    formatcode1 = formatcode1.Substring(0, formatcode1.IndexOf(" - "));
                                formatcode1 = formatcode1.Replace("-", "").ToString();
                                if (formatcode1.Length == 21)
                                    try
                                        if (formatcode1 == Global.formatcode)
                                            Global.omatrix.Columns.Item("1").Cells.Item(lastnum + 1).Click(SAPbouiCOM.BoCellClickType.ct_Regular, 0);
                                            Global.oapplication.ActivateMenuItem("5910");
                                            break;
                                        else
                                            if (System.Convert.ToInt64(Global.formatcode.Substring(0, 13)) <= System.Convert.ToInt64(formatcode1.Substring(0, 13)))
                                                break;
                                    catch { }
                                lastnum = i2;

    Thanks, rkaufmann87, I've tried that many times thinking I can sneak up on it (funny when we're to the point to try ANYTHING)----AB not cooperating on that one, either. The group will delete, but the names/cards are still on the main list and won't delete from the main Address Book. If you "select all" it goes back to the Address Book main list, not the group which is wanting to be deleted.

  • How to delete large number of email notifications from facebook

    I have been receiving email notifications from facebook for years. I only know how to delete them one at a time. I now want to clean up my computer and do not know how to delete these unneeded emails. they number in the thousands.

    Holding Shift while you click selected everything between two mouse clicks.
    Using Ctrl you can fine turn what is selected by clicking on thing to unselect them
    Got the idea?

  • Delete large number of names from address book

    By mistake I imported a large database of names and addresses into Address book a while ago.
    I now find the Address book is too bulky and wish to remove 80% of the names.
    How can I do this easily? Or is is simple to start a new address book from scratch?
    Thanks

    Thanks, rkaufmann87, I've tried that many times thinking I can sneak up on it (funny when we're to the point to try ANYTHING)----AB not cooperating on that one, either. The group will delete, but the names/cards are still on the main list and won't delete from the main Address Book. If you "select all" it goes back to the Address Book main list, not the group which is wanting to be deleted.

  • Copying file from one event to another deleted large number of photos

    I was doing some house keeping on my Photo Library in iPhoto11.
    I opened a event and selected al the photos in this event and then copied them to another event. This operation took a very long time. The end effect is that in excess of 10k photos have dissappeared from my libary and are nowhere to be seen.
    I tris rebuildingt the library but this makes no imprevement but it shows that the library size reduces from 12Gb to about .5 Gb. But both librarys seems to be identical. So where have my photos gone? I have about 6 years worth of photos in this library and because of an earlier problem with OSX on my laptop I had to move this library to an external disc which is not backed up. I think I may have an older backup! I did to at any point press delete or move anything to the trash - this seems to be a software but - any suggestion how to recover my photos. I have checked the system trash and they do not seem to be there either.
    Help

    Open the event and select the photo you want to duplicate, go to the edit menu and select copy (command-c), go to all events and select the target event and go to the edit menu and select paste (command-v)
    another possible alternative it to use albums - make a new album and drag the photo to it - this saves disk space since the photo only exists once no matter how many albums you place it in - the albums simply reference the photo in the event
    LN

  • Deleting large number of records

    Hi Gurus,
    I need to delete millions of records from a table of a specific column.
    This cloumn is of type BLOB and text data in column looks like
    #29/07/2010 2:20 PM#Eevent#MyEvent#MyClass_classToSchedule=abcd
    I need to delete records based on partial value of above column(based on 'MyClass_classToSchedule=abcd' ).
    Please help me to write a query for this.
    Should I need to convert BLOB to VARCHAR2 or is there any other optimized way ?
    Note: I dont want to use 'like' and 'nvl' in the query ( as those are very costly operation).
    Thanks and Regards,
    Nitesh

    How many rows are in the table and how many do you want to delete aproximately?
    Sometimes it is better to copy the remaining rows to a temporary table and truncate the original table instead of deleting it.
    This is if the delete itself is the slow process.
    In your case also the search logic inside the blob might be slow. Is it really a blob or is it a clob?
    Some ways to speed this up have already been suggested.
    I think the oracle text index using the contains comparison is a very promising one.

  • I am trying to delete a large number of songs from my Itunes library without having to delete them one at a time.  How do I do that?

    I am trying to delete a large number of songs from my itunes library without having to do it one at a time.  How can I do this.  All of my songs have check marks by them.  Help!

    Then I suspect you do not have iTunes Match enabled. Using that "delete all" command in the Settings does not remove the music from the cloud, nor does it disable iTunes Match. With iTunes Match enabled you will still see all the music.
    So go to Settings > iTunes and App Store and make sure iTunes Match is set to ON (green).

  • How do I delete a large number of songs off my iPad

    I have a large music collection and have downloaded a large number of songs onto my iPad (10GB).  I don't need that much music on my iPad and would like to put the songs back in the cloud.  I don't want to have to delete thousands of songs one at a time by swiping.  What is the best way to do this?
    I have a 4th gen iPad and I have iTunes Match.

    Then I suspect you do not have iTunes Match enabled. Using that "delete all" command in the Settings does not remove the music from the cloud, nor does it disable iTunes Match. With iTunes Match enabled you will still see all the music.
    So go to Settings > iTunes and App Store and make sure iTunes Match is set to ON (green).

  • How can I delete all my junk mail or a large number of emails in one go?

    Please can someone tell me if I can delete all the mail in my junk or a large number of mail (100+) in go? I'm so fed up of spending 5-10 mins just selected each mail and deleting it one by one!
    Please help or apple update ASAP. Even old school phones have a delete all button!
    Thanks :)

    Lulu6094 wrote:
    Even old school phones have a delete all button!
    But the iPad mail app does not have one. You must select them one at a time.
    http://www.apple.com/feedback/ipad.html

  • I have accidentally deleted a large number of develped images in Lightroom before I did a backup. I reimported the original raw files back into Lightroom hoping the develop settings would be re-established but no luck. Notice system mau have done an auto-

    Question?
    I have accidentally deleted a large number of develped images in Lightroom before I did a backup. I reimported the original raw files back into Lightroom hoping the develop settings would be re-established but no luck. Notice system mau have done an auto-backup as have an lrcat-journal file. Can I use this to restore my develop settings. I also have jpgs generated from all the deleted images.

    Hello,
    if you have a backup of your catalog you can do the following:
    1. Backup your catalog first
    2. Restore your backup catalog to some location
    3. Open your current catalog and select "files->import from another catalog".
    4. Select your backup catalog and your lost images. LR ask you if you want to overwrite the current settings or save them as a virtual copy.
    As an alternativ you can open your backup catalog, select the "lost" images and save the development settings as xmp sidecar fiels (using ctrl-s). Then open your current catalog, seletct the images and use "Metadata->Read Metadata from files".

  • How can I delete a large number of messages from my iCloud mailbox in bulk mode?

    I decided that I have a large number of e-mail messages in my iCloud mailbox that I do not need anymore and I would like to delete these messages in a single - simple move. How can I do it (Gmail offers a nice way to do this but I cannot find anything similar in iCloud...)?

    Archive the contacts you have in Address book, then delete them, they will be removed from iCloud as well. Restore the archive

  • How do i go about deleting a large number of files at the same time?  where's the easiest place to do it?

    how do i go about deleting a large number of files at the same time?  where's the easiest place to do it?

    A bit vague as to what you intend, but the simple answer is to select all the files you want to delete then either drag to the Trash or CTRL- or RIGHT-click on the selection and choose Move to Trash from the contextual menu.

Maybe you are looking for