Slow delete whether or not deleted singly or as a group

During performance analysis for my project I found some code where deletes from table y (I will call it), were being deleted in a loop, thus deleting one record at a time where there are approx. 87,000 records to delete.  Table y has 200 million records.  I rewrote the code to do a delete by internal table, i.e. DELETE y FROM TABLE t_y, to delete all 87,000 records at once.  The strange thing that is happening is that the deletes take about the same time whether it is a one by one delete or all at once by internal table, ~40ms per deleted record.  The delete by internal table shows in the job statistics and ST05 that it is processing 256 records at a time, so there are 340 items in the trace for the DELETE (340 * 256 ~= 87,000).  All of the reads, updates, and selects take about 1ms per record.  The internal table (t_y) is typed exactly like the transparent table.  All of the records requested to be deleted are in the table y and there are no duplicates in the internal table.
Old Code:
LOOP AT t_y.
     DELETE y FROM t_y.
ENDLOOP.
New Code:
DELETE y FROM TABLE t_y.
It takes approx. 1 hour to delete 87,000 records.  So the question is why deleting all records has the same speed as deleting one by one.  Secondarily, why is the system only sending 256 ercords at a time to be deleted.
Thanks,
Andy Goerdel

Hi Andy,
> one by one delete or all at once by internal table, ~40ms per deleted record.
> updates, and selects take about 1ms per record
first of all the delete has to touch the table and all indexes which is not the case for select and not necessarily for the update.
So depending on the number of indexes defined a delete has to be slower than a select or an update (which does not touch all rows) because it has to do more i/o.
> It takes approx. 1 hour to delete 87,000 records.  So the question is why deleting all records has the same speed as
> deleting one by one. 
that is an interesting one. One should assume that the array processing should be sligthly faster... .
> Secondarily, why is the system only sending 256 records at a time to be deleted.
The SAP application server communicates in blocks (size depends... could be 32, 40, 64 or 128) with the database.
The key fields for the delete are filled in such a block until it is full. You have no influence here.
How much indexes are defined on your table? The 40 ms is most likely driven by physical i/o for table and index blocks.
The amount of i/o that needs to be done is the same for one by one or for array processing. The array interface only
redcues the number of calls. Obviously these savings are relatively small compared to the i/o that needs to be done
in any case.
With ST04 you can check how much physiscal i/os are redquired for your deletes.
Kind regards,
Hermann

Similar Messages

  • Delete command is not deleting all rows

    Hi All,
    Database version 10.2.0.2
    Delete command is not deleting all rows and deleting some subset of rows which it should delete, ever time I delete and do the roll back, next time it will delete some random rows, count is different everytime with in the range but not complete in anyway. see the following -
    select count(*) from test where evt_id in (select evt_id from test1);
    COUNT(*)
    27105
    delete from test where evt_id in (select evt_id from test1);
    16045 rows deleted.
    select count(*) from test where evt_id in (select evt_id from test1);
    11060
    rollback;
    Againg the same procedure -
    select count(*) from test where evt_id in (select evt_id from test1);
    COUNT(*)
    27105
    delete from test where evt_id in (select evt_id from test1);
    14320 rows deleted.
    select count(*) from test where evt_id in (select evt_id from test1);
    COUNT(*)
    12785
    why its not deleting all the 27k rows in one shot? Is there any bug related to that?
    Thanks
    Abhinav

    Odd that what looked like identical statements produced different results, both the counts and the deletes. The most likely cause of that is your data is changing - as Fahd suggested perhaps a simultaneous load taking place.
    The delete issue is probably not due to a bug. Possible but unlikely.
    If any evt_id values are NULL they won't be deleted with the subquery - a NULL in test.evt_id will never match a NULL in test1.evt_id.
    Have you tried alternative subqueries - a correlated EXISTS subquery for instance?

  • Deleted pop mail not deleted from server

    mail retrieved from pop acct & deleted, and trash emptied, is not deleted from server, so it gets re-retrieved.
    settings>delete from server> when removed from inbox, but the msgs are still on the server as viewed from the isp's web interface.

    been there, done that;-}
    Incoming mail server (POP3): pop.verizon.net
    Incoming Server Port Numbers: 995
    Outgoing mail server (SMTP): smtp.verizon.net
    Outgoing Server Port Numbers: 465
    it seems mail.app is designed for imap, in that msgs can't be deleted when d/l'd by default, but must be config'd "when moved from inbox"

  • Delete obsolete does not delete all backupset

    Dear friends,
    I take backup with the "backup database plus archivelog". For example, it took 3 backup, 3 archivelog and 1 control files. I took a backup 5 minutes later to try "delete obsolete" command. It also took same number of files.
    When i typed "delete obsolete" command, it only removes 1 backup and 1 control file from old backupset. 2 backup and 3 archivelog files are still there.
    What am i wrong? OR How can i delete all old backupset files(backups,copies,controlfiles,...)?
    You can find the details below,
    Thanks in advance and Best Regards;
    Onur
    RMAN> show all;
    RMAN configuration parameters are:
    CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
    CONFIGURE BACKUP OPTIMIZATION OFF; # default
    CONFIGURE DEFAULT DEVICE TYPE TO DISK;
    CONFIGURE CONTROLFILE AUTOBACKUP ON;
    CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/oranew/arch/cf_%F';
    CONFIGURE DEVICE TYPE DISK PARALLELISM 1;
    CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1;
    CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1;
    CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT '/oranew/arch/%U.bak';
    CONFIGURE MAXSETSIZE TO UNLIMITED; # default
    CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/oranew/9i/dbs/snapcf_....f'; # default
    CONFIGURE EXCLUDE FOR TABLESPACE 'CWMLITE';
    CONFIGURE EXCLUDE FOR TABLESPACE 'EXAMPLE';
    List of Backup Sets
    ===================
    BS Key Device Type Elapsed Time Completion Time
    812 DISK 00:00:01 11-JUL-06
    BP Key: 813 Status: AVAILABLE Tag:
    Piece Name: /oranew/arch/1hhntfj9_1_1.bak
    List of Archived Logs in backup set 812
    Thrd Seq Low SCN Low Time Next SCN Next Time
    1 270 1147860 11-JUL-06 1147877 11-JUL-06
    BS Key Type LV Size Device Type Elapsed Time Completion Time
    816 Full 313M DISK 00:01:50 11-JUL-06
    BP Key: 817 Status: AVAILABLE Tag:
    Piece Name: /oranew/arch/1ihntfjd_1_1.bak
    List of Datafiles in backup set 816
    File LV Type Ckp SCN Ckp Time Name
    1 Full 1147880 11-JUL-06 /oranew/oradb/oradata/.../system01.dbf
    2 Full 1147880 11-JUL-06 /oranew/oradb/oradata/.../undotbs01.dbf
    4 Full 1147880 11-JUL-06 /oranew/oradb/oradata/.../drsys01.dbf
    6 Full 1147880 11-JUL-06 /oranew/oradb/oradata/.../indx01.dbf
    7 Full 1147880 11-JUL-06 /oranew/oradb/oradata/.../tools01.dbf
    8 Full 1147880 11-JUL-06 /oranew/oradb/oradata/.../users01.dbf
    BS Key Device Type Elapsed Time Completion Time
    828 DISK 00:00:01 11-JUL-06
    BP Key: 829 Status: AVAILABLE Tag:
    Piece Name: /oranew/arch/1jhntfn4_1_1.bak
    List of Archived Logs in backup set 828
    Thrd Seq Low SCN Low Time Next SCN Next Time
    1 271 1147877 11-JUL-06 1147884 11-JUL-06
    BS Key Type LV Size Device Type Elapsed Time Completion Time
    832 Full 1M DISK 00:00:01 11-JUL-06
    BP Key: 833 Status: AVAILABLE Tag:
    Piece Name: /oranew/arch/cf_c-4041210959-20060711-00
    Controlfile Included: Ckp SCN: 1147886 Ckp time: 11-JUL-06
    BS Key Device Type Elapsed Time Completion Time
    839 DISK 00:00:01 11-JUL-06
    BP Key: 840 Status: AVAILABLE Tag:
    Piece Name: /oranew/arch/1lhntfod_1_1.bak
    List of Archived Logs in backup set 839
    Thrd Seq Low SCN Low Time Next SCN Next Time
    1 270 1147860 11-JUL-06 1147877 11-JUL-06
    1 271 1147877 11-JUL-06 1147884 11-JUL-06
    1 272 1147884 11-JUL-06 1147890 11-JUL-06
    BS Key Type LV Size Device Type Elapsed Time Completion Time
    845 Full 313M DISK 00:01:51 11-JUL-06
    BP Key: 846 Status: AVAILABLE Tag:
    Piece Name: /oranew/arch/1mhntfoh_1_1.bak
    List of Datafiles in backup set 845
    File LV Type Ckp SCN Ckp Time Name
    1 Full 1147893 11-JUL-06 /oranew/oradb/oradata/.../system01.dbf
    2 Full 1147893 11-JUL-06 /oranew/oradb/oradata/.../undotbs01.dbf
    4 Full 1147893 11-JUL-06 /oranew/oradb/oradata/.../drsys01.dbf
    6 Full 1147893 11-JUL-06 /oranew/oradb/oradata/.../indx01.dbf
    7 Full 1147893 11-JUL-06 /oranew/oradb/oradata/.../tools01.dbf
    8 Full 1147893 11-JUL-06 /oranew/oradb/oradata/.../users01.dbf
    BS Key Device Type Elapsed Time Completion Time
    857 DISK 00:00:01 11-JUL-06
    BP Key: 858 Status: AVAILABLE Tag:
    Piece Name: /oranew/arch/1nhntfs8_1_1.bak
    List of Archived Logs in backup set 857
    Thrd Seq Low SCN Low Time Next SCN Next Time
    1 273 1147890 11-JUL-06 1147898 11-JUL-06
    BS Key Type LV Size Device Type Elapsed Time Completion Time
    861 Full 1M DISK 00:00:01 11-JUL-06
    BP Key: 862 Status: AVAILABLE Tag:
    Piece Name: /oranew/arch/cf_c-4041210959-20060711-01
    Controlfile Included: Ckp SCN: 1147900 Ckp time: 11-JUL-06
    RMAN> delete obsolete;
    RMAN retention policy will be applied to the command
    RMAN retention policy is set to redundancy 1
    using channel ORA_DISK_1
    Deleting the following obsolete backups and copies:
    Type Key Completion Time Filename/Handle
    Backup Set 816 11-JUL-06
    Backup Piece 817 11-JUL-06 /oranew/arch/1ihntfjd_1_1.bak
    Backup Set 832 11-JUL-06
    Backup Piece 833 11-JUL-06 /oranew/arch/cf_c-4041210959-20060711-00
    Do you really want to delete the above objects (enter YES or NO)?

    Dear Kuljeet,
    I am new in rman. As i understood from your reply that rman only deletes the backup piece which includes all dbfs and its related control file. These two files are deleted from catalog and also from filesystem.
    But other archievelogs (from first backup) joins to the second backup,as you said. This goes on like that in every backup if we take backup with "plus archivelog" parameter. Am i right?
    And they won't be deleted from the file system.
    I think the answers to the following questions will solve my confusion.
    1. Should not we delete (from catalog and fs, for ex. "delete archivelog ...") the previous archivelogs, even the latest backup set is enough to recover database?
    2. Let's say, we moved all these files (old archivelogs and latest dbf backups) to tape. I don't think so but should we keep all the old archivelogs to recover db even the ones from the latest backup is enough?
    3. Is "plus archivelog" parameter very important for a backup?
    I was confused about the principles of "delete obsolete" when the backup was taken with "plus archivelog" parameter. If you can explain it shortly, i will be very pleased. Why it did not delete all pieces of the previous backup set (from catalog and fs.), while the latest backup set is enough to recover db? I could not understand this.
    Thanks in advance and best regards,
    Onur

  • RMAN "delete noprompt obsolete" not deleted

    OS: AIX 5.3L; Oracle 10g R2
    I have "delete noppropt obsolete" in my RMAN backup script as {
    delete noprompt obsolete;
    crosscheck backupset;
    crosscheck archivelog all;
    delete noprompt expired backup;
    delete noprompt expired archivelog all;
    backup as compressed backupset incremental level 1 cumulative device type disk tag 'Baan_bkup$LEVEL1' database plus archivelog delete input; }
    but the incremental level 1 cumulative backupsets, outside my 7 days window, did not been deleted as prompted, even they are under the obsolete list. Why?
    Message was edited by:
    user508054

    I also observed that with "REPORT OBSOLETE", only partial of the backupset piece of backup were "OBSOLETE". For example, after this morning LEVEL 1 incremental backup, my last Sunday, Mar 4 level 0 backup has 12 backup pieces (including controlfile and archivelog), but only two have been on the obsolete list. The two are controlfile and archivelog, and other 10 datafaile backupsets are still there in the list. Really confused! Are they supposed to be treated as a bunch?

  • Files "Deleted from Disk" not deleted

    I was under the impression that this problem related to the appearance of "Ghost" drives (duplicate drives appearing in the LR after I edited a file. The folder duplications are no longer a problem in LR 2.1
    HOWEVER, when I use the option "delete from disk" (vs. remove)these files are not getting deleted from my hard drive. They reappear on the next folder synchronization I run.
    I am either asking for input on how to make deletions stick and/or requesting that Adobe look into this before releasing the release version of 2.1
    Thanks - Kevin
    System info:
    LR 2.1
    Windows Vista Home Premium
    Quad Core PC with 4GB RAM
    1 TB "RAID 5" system drives (4 of them make up the 1 TB)

    Thanks for the suggestions but they didn't work:
    1- Cleared preferences by hitting the various reset to factory buttons. Then closed and restarted LR. Is there another way to do this?
    2- The foloder quantity goes down when I delete and goes back up when I synchronize
    3- File manager shows the same number of files as LR BEFORE I delete and then shows more AFTER I delete. Then, after synchronizing they are back to equal.
    Finally, I tried deleting a file in windows explorer to see its effect. It immediately showed as missing in LR. I synchronized and that file was deleted.
    Any other ideas?

  • IMessage deleted from iPhone not deleted from iPad

    I have my iMessages set up so they go to both my iPhone and my iPad and that's great. However, if I delete an iMessage from my iPhone, it does not get deleted from my iPad (and vice versa). Is there any way to set things up so my deletions also get synced? Thanks in advance for any suggestions.

    Deactivate iMessage on your phone, then reactivate it.

  • Deleting history does not delete the log of calls ...

    In order to delete history, I followed the recommended procedure:
    Skype --> privacy --> clear history --> save
    The history appears cleared: however, when I do this
    Skype --> account --> view call history
    the entire history is still there. Any ideas how to clear this?

    Hi,
    Our call history as it appears in our accounts remains on record where we can review it for a term of six (6) months.  I am not aware of any means for us to "remove" or to "delete" these records; you would need to contact Skype customer service to enquire further.
    Regards,
    Elaine
    Was your question answered? Please click on the Accept as a Solution link so everyone can quickly find what works! Like a post or want to say, "Thank You" - ?? Click on the Kudos button!
    Trustworthy information: Brian Krebs: 3 Basic Rules for Online Safety and Consumer Reports: Guide to Internet Security Online Safety Tip: Change your passwords often!

  • Messages deleted on Playbook not deleted when I get home

    I appear to be having the opposite problem many folks are having. I take my Playbook to work during the day. Read my email. I get home, open Apple Mail on my laptop, and the messages, while no longer listed as new, are still in my account! I have to manually go through and delete each email! When I click the Trashcan icon on the Playbook, I expect the email to be deleted. Period. My email provider is Apple iCloud which is just iMAP. I've searched the internet and forums far and wide for a solution, but no one seems to have a decent answer or even a hypothesis. Any suggestions?
    Is anyone using GMail with the Playbook 2.0 successfully (using iMAP) and when messages are deleted, they're deleted? And contacts and calendar with GMail sync successfully? Because if I can't solve problem above, I'm unfortunately willing to switch to GMail as my provider. I've waited so long for 2.0 and can't believe I'm having such a major issue. I'm not going to twice delete each messsage each day given the volume of email I receive.
    Ideas, suggestions, troubleshooting tips welcome.
    Thanks in advance -
    Matt

    Pop and imap are old. Microsoft said years ago to remove them from mailservers and mine does not support it.
    I have since then used only exchange active sync aka EAST. It works well and lets you do more. 
    Gmail works with it too and that his I use Gmail to sync contacts, calendar and my email.
    Click here to Backup the data on your BlackBerry Device! It's important, and FREE!
    Click "Accept as Solution" if your problem is solved. To give thanks, click thumbs up
    Click to search the Knowledge Base at BTSC and click to Read The Fabulous Manuals
    BESAdmin's, please make a signature with your BES environment info.
    SIM Free BlackBerry Unlocking FAQ
    Follow me on Twitter @knottyrope
    Want to thank me? Buy my KnottyRope App here
    BES 12 and BES 5.0.4 with Exchange 2010 and SQL 2012 Hyper V

  • Deleted Hotmail emails not deleting on BB

    I have had my phone for over a year now, and have had no problem with emails syncing, etc.
    My BB emails are connected to a Hotmail account.
    But all of a sudden, if I delete emails on my Hotmail, they won't delete on my phone, meaning I have to do it manually, which is annoying.
    I have tried deleting and adding the email account again on my BB but I still have the same problem.
    Even when I choose to Reconcile, whatever that means, nothing happens.
    Please help?
    Thanks.
    Solved!
    Go to Solution.

    Hi and welcome to the forums!
    As listed in the article below:
    Note: Windows Live Hotmail does not support the reconciliation of deleted items.
    Thanks,
    Bifocals
    BlackBerry Internet Service version 4
    Click Accept as Solution for posts that have solved your issue(s)!
    Be sure to click Like! for those who have helped you.
    Install BlackBerry Protect it's a free application designed to help find your lost BlackBerry smartphone, and keep the information on it secure.

  • TS3672 why my iphone is so static when i put my finger on the top of the screen its moving up and down, and when I open my emails the screen keeps on moving I cant even read and when I'm testing when I press delete it does not deleting the letters but add

    Hello I am having problems with my iphone when i am texting i cant get hold with the letters correctly when i press p it goes o,or other letters which I dont need and it will send automatically what should i do with this its annoying

    is anyone can help me with regards with my problems? pls help thank you
    Message was edited by: BingDrT

  • Just upgraded to OS Mavericks and my delete key in Mail does not delete it just moves the cursor up

    I just upgraded to OS Mavericks. In Mail my delete key does not delete. When I hit delete the message above the one I was reading is highlighted. How can I fix this?

    open up a terminal (either type in "terminal" in spotlight search (the magnify glass in top right corner) or in the Finder (New Folder Window) Applications -> Utilities -> Terminal) and enter:
    defaults write com.apple.mail IgnoreSortOrderWhenSelectingAfterDelete 1

  • How can I tell whether or not a photo I delete from iPhone will also be deleted from iPhoto on my Mac?

    I would like to download the new iOS, however when I go to do that, a message tells me that I cannot because I need 4.6 GB of storage in order to install it. I only currently have 864 MB of storage available on my 16 GB iPhone 5s.
    The storage problem would be fairly easy to solve through deleting photos and/or videos, as the Photos & Camera app shows a current usage of 5.7 GB. I am perfectly comfortable deleting photos off my iPhone if I know that they will remain in iPhoto on my Mac. However, when I select photos to delete, the phone warns me that the photo(s) will also be deleted from Photo Stream on all my devices. I tested this with some photos I didn't care about (whether or not they got permanently deleted from all devices), and it is perplexing, because even though the iPhone warned me that the photos would be deleted on other devices, they have not deleted out of iPhoto on my Mac. I even Quit iPhoto and re-started it, but the photos are still there. Why would the iPhone claim that the photos would be deleted from other devices, but yet clearly the photos are not being deleted from my other device? This leaves me confused and unsure.
    Meanwhile, if I select a bunch of photos then click Delete, the phone warns me that SOME photos will also be deleted from Photo Stream on all my devices.
    I am very annoyed by the ambiguity of the word "some," and not being able to know for sure whether or not photos I delete off my iPhone will still remain in iPhoto on my Mac.
    I would just like a really clear answer if possible: currently all my iPhone photos are showing up in iPhoto on my Mac. If I delete photos off of my iPhone, will they or won't they be deleted from iPhoto on my Mac?
    Thanks if anybody can help.

    xcwomac wrote:
    I would just like a really clear answer if possible: currently all my iPhone photos are showing up in iPhoto on my Mac. If I delete photos off of my iPhone, will they or won't they be deleted from iPhoto on my Mac?
    Thanks if anybody can help.
    If the Photos have been moved into the Library (Events, Photos, Faces, Places) in iPhoto on your Mac (either because you did it manually or as a result of iPhoto > Preferences > iCloud > Automatic Import being on) then nothing you do on the phone will delete them from iPhoto on your Mac.
    If the Photos are ONLY in the Shared - iCloud section of iPhoto then you risk losing them as deleting them from Photo Stream will delete them from there.

  • Iphone4 to 6.3.1, not single delete personal records Even deleted

    Why update my iphone4 to 6.3.1, not single delete personal records
    Even deleted, not when the machine is flash back
    I delete the phone number will appear simply no way to single delete records of calls reopen

    Please post in your native language. This makes very little sense in English.

  • While typing in an email, I can not delete or backspace a single letter. When I delete one letter, the whole line disappear.

    While typing in an email, I can not delete or backspace a single letter. When I delete one letter, the whole line disappear. I am using Window 7 and latest Firefox.
    == This happened ==
    Every time Firefox opened
    == Using Firefox on my new machine with Window 7.

    Start Firefox in [[Safe Mode]] to check if one of your add-ons is causing your problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
    See [[Troubleshooting extensions and themes]] and [[Troubleshooting plugins]]
    If it does work in Safe-mode then disable all your extensions and then try to find which is causing it by enabling one at a time until the problem reappears.
    You can use "Disable all add-ons" on the [[Safe mode]] start window to disable all extensions.
    You have to close and restart Firefox after each change via "File > Exit" (Mac: "Firefox > Quit"; Linux: "File > Quit")

Maybe you are looking for