SQL Updates, locks and multithreading

I am trying to do the following:
Updating 5M rows in multiple database writer thread using OCI. I have not set any Oracle parallel execution related parameters yet.
However, it is found that there is no performance improvement in doing this in multiple threads.
My questions:
1. Does Oracle lock the table during each update? I think it does and that is why there is no performance enhancement.
- If yes, is there any way to tell Oracle not to lock the table during updates. As it is, my threads will never update the same row in parallel.
2. Is the way out is to do the following?
- Partition the table
- Do an "ALTER SESSION ENABLE PARALLEL DML"
- Fire updates
3. Is there any OCI way of doing this?
Thanks in advance,
~Sri

I am trying to do the following:
Updating 5M rows in multiple database writer thread using OCI. I have not set any Oracle parallel execution related parameters yet.
However, it is found that there is no performance improvement in doing this in multiple threads.
My questions:
1. Does Oracle lock the table during each update? I think it does and that is why there is no performance enhancement.
- If yes, is there any way to tell Oracle not to lock the table during updates. As it is, my threads will never update the same row in parallel.Unless you're explicitly locking the table, Oracle won't lock it. Oracle doesn't ever escalate row locks to table locks.
My guess is that something in your system is bottlenecked. Perhaps your disk, CPU, or RAM is maxed out. Perhaps your system is busy waiting to switch redo logs. There are lots of potential bottlenecks here, you'd have to do some investigation to figure out what's taking so long.
One quick thing you might try is to use the /*+ append */ hint (i.e. insert /*+ append */ into table (your query here)). This tells the database to do a parallel direct path load, avoiding most redo log generation. This improves the speed, but isn't particularly friendly for database recovery. Make sure you read the documentation on this hint before you use it.
You may also be able to change your SQL to use the bulk collection syntax.
I'd also take a look at this bit of the Oracle documentation, "Serial and Parallel INSERT"
<http://technet.oracle.com/docs/products/oracle8i/doc_library/817_doc/server.817/a76965/c21dlins.htm#2507>
There's a pretty good asktom article over here. Search the site and you'll find lots of info on this sort of thing.
<http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:1119033812977>
2. Is the way out is to do the following?
- Partition the table
- Do an "ALTER SESSION ENABLE PARALLEL DML"
- Fire updatesI'm assuming that you have the partitioning options in your database. If so, this is likely to be faster, though I'm not sure by how much. Have you benchmarked a test to see? Of course, if you account for the time to partition the table, you're likely to remove all of your performance gain.
Also, unless you are able to spread your inserts across the various partitions, you're unlikely to see any performance benefit.
This strikes me as a pretty drastic approach.
3. Is there any OCI way of doing this?Well, you could execute the SQL above against the table from OCI. I'd recommend doing this sort of thing from SQL*Plus or something of that genre, though, simply because folks may get upset at you if your application partitions their tables for them.
Thanks in advance,
~Sri

Similar Messages

  • Ipod Touch 5.1.1 update lock and volume buttons wont work.

    So I just updated my ipod touch 4G to the ios 5.1.1 version and ever since my volume and lock buttons aren't working/responding. The funny thing is, a lot of people are posting the same question but they get the same answer from the same person that says to hold the lock and home button when everybody specifally states that the lock and volume buttons aren't working so those answers are useless. I tried resetting all the settings to factory from the settings menu but still the same problem. What should I do? Is it a bug for every new updater?

    Try changing the DNS server on the iPod. See:
    iOS 5 update issues  "Network...: Apple Support Communities

  • UPDATE statement and database locks

    Hello everybody,
    I have a problem related to an UPDATE statement. There are two applications, let say A and B.
    Application A executes:
    update some_table
    set some_field = 'value_A',
    where pk_field=1
    no commit!
    Application B executes:
    update some_table
    set some_field = 'value_B',
    where pk_field=1
    Now application B is locked and wait until application A executes a commit.
    THIS IS A PROBLEM!
    I know one way to solve this problem:
    Both applications should execute "select for update nowait" before
    updating a row.
    Is there any other solutions? Something like "update nowait"?
    thanks in advance
    Dmitri Geller
    DGeller (at) lhsgroup dot com

    The major difference between my approach and standard "select for update nowait + update"
    approach, is more information for user : who blocked his object, and when. Else , i don't see the
    differences. Yep. And a Boieng 747 and bicycle is not much a difference as both are used for transporting people.
    Are you against select + nowait ?No, I am for understanding transaction isolation, serialisation, ACID principles, the differences between optimistic and pessimitic locking and so on
    You wrote "THE LOCK is good". OK, and what about time ?The two has NOTHING to do with one another. Not a single thing.
    In real industrial systems the users cannot wait more then few seconds. But the transactions can
    run much more. It isn't acceptable.If by implication you mean that I'm in the .edu environment that does not deal with "real corporate systems", I'm not.
    I recently wrote a special replicator in PL/SQL. It makes extensive use of customised parallel processing (does not use PQ as it also support Oracle SE). It hits very busy tables (with far over a 1000 rows/sec transaction rate). I did not have to hack my own form of locking. Performance is excellent.
    Why? Not because I am a brilliant Linus-like programming genius. Simply because I used Oracle as it has been designed to use.
    Can you claim the same? Can you show me the Oracle reference material that states that you need to write your own Lock Manager? Can you show me expert opinion from recognised inviduals such as Tom Kyte, Jonathan Lewis, Gary Milsap and others that state that Oracle's concurrency controls need to be hacked like you did in order to make it work?
    Can you provide me with any sound technical evidence to backup your claims that your method is better than what Oracle has built into the core of the database?

  • My itunes was updated recently and now it wont let me open it, comes up saying it is on a locked disc..how do i fix this?

    recently i updated my itunes and since it comes up with a message saying the disc is locked and i dont have permission to open the itunes folder. Has anyone else had this issue?

    See Troubleshooting issues with iTunes for Windows updates.
    tt2

  • LOCKS checking user locked and SQL that he is executing

    Hello all,
    I have this script that inserts into a table the user causing the lock and the users waiting for the lock to be released.
    What I would like to add into this the script is the SQL string that the user causing the lock and the users waiting for the the lock to be released are executing.
    Can you help me on this?
    Script that I have now:
    insert into dba.sessions_bloq
    select sysdate "Data", w.sid "SID E", s1.username "User E", s1.osuser "OS User E", s1.machine "Maquina E", s1.program "Programa E", s1.logon_time "Logon E",
    s.ksusenum "SID B", s2.username "User B", s2.osuser "OS User B", s2.machine "Maquina B", s2.program "Programa B", s2.logon_time "Logon B"
    ,decode(r.ksqrsidt,
    ''MR'', ''Media Recovery'',
    ''RT'', ''Redo Thread'',
    ''UN'', ''User Name'',
    ''TX'', ''Transaction'',
    ''TM'', ''DML'',
    ''UL'', ''PL/SQL User Lock'',
    ''DX'', ''Distributed Xaction'',
    ''CF'', ''Control File'',
    ''IS'', ''Instance State'',
    ''FS'', ''File Set'',
    ''IR'', ''Instance Recovery'',
    ''ST'', ''Disk Space Transaction'',
    ''TS'', ''Temp Segment'',
    ''IV'', ''Library Cache Invalidation'',
    ''LS'', ''Log Start or Switch'',
    ''RW'', ''Row Wait'',
    ''SQ'', ''Sequence Number'',
    ''TE'', ''Extend Table'',
    ''TT'', ''Temp Table'',
    r.ksqrsidt) "Tipo Lock"
    from gv$session_wait w, x$ksqrs r, gv$_lock l, x$ksuse s, gv$session s1, gv$session s2
    where w.wait_Time = 0
    and w.event = ''enqueue''
    and r.ksqrsid1 = w.p2
    and r.ksqrsid2 = w.p3
    and r.ksqrsidt = chr(bitand(p1,-16777216)/16777215)||
    chr(bitand(p1,16711680)/65535)
    and l.block = 1
    and l.saddr = s.addr
    and l.raddr = r.addr
    and s.inst_id = userenv(''Instance'')
    and w.sid = s1.sid
    and w.inst_id = s1.inst_id
    and s.ksusenum = s2.sid
    and s.inst_id = s2.inst_id;
    Thanks in advance

    You can link to:
    gv$sql
    gv$sqltext_with_newlines
    but, if doing this in a trigger, also look at these:
    http://www.psoug.org/reference/system_events.html

  • SQL: System locks up and runs slow after performing simple DML record insert

    SQL Version:  2008 R2
    I am having a serious problem.  I ran the following code to perform a simple table record insert which ran successfully.  However, after running this code I could no longer access the related table.  I couldn't run a query against it. 
    I tried to delete all the records and that wouldn't work either.  When attempting to run any DML statements (i.e. Select * From vPCCertificateTypes) against this table SQL gets locked up and never returns anything and no error messages.  I have
    to manually stop the query.  Now the entire SQL system is running slow.
    Any help would be greatly appreciated.  The code I ran to originally insert the records is below.
    Regards,
    Bob Sutor
    CODE: 
    Begin TRAN
     INSERT INTO vPCCertificateTypes (VendorGroup, CertificateType, Description, Active, Category)
     SELECT HQCo, 'MBE', 'Minority-owned Business Enterprise', 'Y', 'Affirmative Action' 
     FROM HQCO
     Where HQCo IS NOT NULL
      AND HQCo <> 100
      AND HQCo <> 99
     IF @@ROWCOUNT <> 44 ROLLBACK ELSE COMMIT
    Bob Sutor

    The problem was an open uncommitted transaction against the table as you suspected.  I ran your code and it cleared the transaction.  In the past I would intentionally leave our the Commit statement and then if the transaction ran fine, I would
    simply highlight and run 'COMMIT' and it would close the transaction.  Apparently that is not the correct approach.  I'll use your suggested code from now on.
    Thanks for the help.
    Bob Sutor

  • Was updating my touch this morning when an error message occured, itunes became non responsive and was shut down.  My touch is locked in the itunes update mode and my computer no longer recognizes the touch.  How do I correct?

    During update, error occured and Itunes became non-responsive and shut down.  My Itouch is now locked in the itunes update screen and is no longer identified by my computer.  How do I fix this problem?

    Try this:
    DFU Mode / Unable to Update or Restore
    http://support.apple.com/kb/HT1808
    DFU Mode
    Open iTunes and Connect the iPhone to your Mac
    Press and Hold the Sleep/Wake Button and the Home Button at the Same Time
    After 10 Seconds release the Sleep/Wake Button until iTunes tells you it has Detected an iPhone in Recovery Mode...
    The Phone Screen will remain Black... Now Restore.
    Backing up, Updating and Restoring
    http://support.apple.com/kb/HT1414

  • HT4623 I started updating my iPhone 3gs but now it is locked and sim is not being recognized by the set

    I started updating my iPhone 3gs but now it is locked and sim is not being recognized by the set

    Sounds like you had the phone hacked to work on a network other than what the phone was originally locked to. When you updated the software on the phone it reverted back to the lock which makes your sim unusable.

  • I had my iphone 4 locked to vodafone uk carrier. I connected the phone to itunes on my pc and tried to update the version to ios 6 through itunes. But it has been locked and asks for sim of previous carrier. how can i return to previous state?

    I had my iphone 4 locked to vodafone uk carrier. I connected the phone to itunes on my pc and tried to update the version to ios 6 through itunes. But it has been locked and asks for sim of previous carrier. how can i return to previous state?

    You cannot return to previous state. The update re-locked the iPhone
    to the original carrier. You must contact the original carrier to see if
    they offer unlocking and if you qualify.
    What does it say when you look at Settings=>General=>Carrier?
    Be advised that if your iPhone had previously been hacked/modified/
    jailbroken to work with other than original carrier, it may be impossible
    for the original carrier to unlock it properly.

  • After updating my Macbook Pro retina display to os x yosemite 10.10.2, the mause and track pad locks, and do not respond especially when using the Mac for a long period, please help, how can I solve this, I do not like feel like in windows, so I paid

    after updating my Macbook Pro retina display to os x yosemite 10.10.2, the mause and track pad locks, and do not respond especially when using the Mac for a long period, please help, how can I solve this, I do not like feel like in windows, so I paid good money for this mack, I feel calm

    Hi Buterem,
    I'm sorry to hear you are having issues with your MacBook Pro since your recent Yosemite update. I also apologize, I'm a bit unclear on the exact nature of the issue you are describing. If you are having intermittent but persistent responsiveness issues with your mouse or trackpad, you may want to try using Activity Monitor to see if these incidents correspond to occupied system resources, especially system memory or CPU. You may find the following article helpful:
    How to use Activity Monitor - Apple Support
    If the entire system hangs or locks up (for example, if the system clock freezes and stops counting up), you may also be experiencing some variety of Kernel Panic. If that is the case, you may also find this article useful:
    OS X: When your computer spontaneously restarts or displays "Your computer restarted because of a problem." - Apple Support
    Regards,
    - Brenden

  • My ipad is locked and it tells me to update my icloud but the screen is not responding to my touch?

    How do I get my screen unlocked so that I can update my ipad.  The screen is not responding to my touch, instead it is telling me... " This ipad hasnt been backed up in  12 weeks. Backups happen when this ipad is plugged in, locked and connnected to wi-fi".  Does this mean that I cant use this untill it is all done backing everything up? And how do I begin to use it since it says its locked?

    Reboot the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons.
    After it boots up again, you will be able to use the iPad. You should backup the iPad like the message is telling you to do.

  • My ipad is locked and disabled after updating to iso 7.  I never had a password on it.

    my ipad is locked and disabled after updating to iso 7.  I never had a password on it.

    Even though you never had a passcode enabled, try the help here >  iOS: Forgotten passcode or device disabled after entering wrong passcode

  • Unable to update, when executed table gets lock and Execution does not stop even for an hour.

    Following is my Query, which unables to update. When Executed, table gets lock and Execution does not stop even for an hour.
    update Employees 
          set Status = 'Close'
          where statusid IN (select statusid 
                                             from MyView 
                                              where DownloadedDate ='2014-07-27 00:00:00.000'
    here Employee contains 3,00,000 of records and Subquery return 1,50,000 Empid 
    i tried in various ways but not able to solve, statusid  column have no index on,  i tried using cursor but it does not work.
    plz let me know how to solve this Issue, Its very Important to get solve as all my further work depends on Updation
    , THANKS IN ADVANCE.

    See also your other thread with the same question:
    http://social.msdn.microsoft.com/Forums/en-US/80243625-fc3b-4ee1-bce1-4adcdbc16c14/unable-to-update-when-executed-table-gets-lock-execution-does-not-stop-execution-even-for-an-hour?forum=sqlserversamples
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • HT201328 Welcome to After I IPHONE 4 black and I want to open internationally so when you want to update the lock and leave me a sign I just want to open an apple and I have developed from my Mac in Saudi Arabia&

    Welcome to After I IPHONE 4 black and I want to open internationally so when you want to update the lock and leave me a sign I just want to open an apple and I have developed from my Mac in Saudi Arabia&amp; the
    <Edited by Host>

    If you want to unlock an iPhone you must contact the carrier it is locked to.
    You are not communicating with Apple in these forums; we are just other users.

  • Updated ios and phone is locked

    Can someone help me please?
    Last night I updated to the latest IOS and the phone said it failed, so I restored the phone.
    This morning when I got up, my phone was locked and my code doesn't work any more.
    I connected to iTunes thinking that if I update the IOS it would fix the problem.  iTunes said I have the latest software.
    I am going through withdrawal because I can't play Word with Friends.  Can someone tell me how to unlock my phone?
    PS:  The phone now displays French instead of English.
    Thanks in advance and Happy 4th of July!

    Hi zyggistardust,
    Welcome to Apple Support Communities.
    It sounds like there was an issue updating your iPhone and now it's displaying a screen that says it's disabled. Try restoring the iPhone from recovery mode, as shown in the article below.
    iOS: Forgot passcode or device disabled
    http://support.apple.com/kb/ht1212
    Use recovery mode
    Follow these steps if you never synced your device with iTunes, if you don't have Find My iPhone set up, or if you can't get to your own computer. You'll need to put your device in recovery mode, which will erase the device and its passcode. Then you'll restore your device as new or from a backup.
    Disconnect all cables from your device.
    Turn off your device.
    Press and hold the Home button. While holding the Home button, connect your device to iTunes. If your device doesn't turn on automatically, turn it on.
    Continue holding the Home button until you see the Connect to iTunes screen.
    iTunes will alert you that it has detected a device in recovery mode.
    Click OK, then restore the device.
    Cheers!
    -Jason

Maybe you are looking for

  • Time Capsule OR Airport Extreme no line out jack?

    Does it make sense to anyone else that Apple choose to inclue a line out jack on the Airport and not on the AP Extreme or TC? I really want a networked drive and one that is also a wireless station would be even better, but right now my cable connect

  • Light gray question mark in Finder window

    In OS 10.4.11, I have just noticed there is a light gray question mark just to the right of the little cog wheel icon (I think it's called "action"; it's a pull down menu.) I don't get any explanation when I run my cursor over it. When I double click

  • Not seeing content in mail folders

    I use default mail with a hotmail account.  I have folders but none of the messages appear when you click on a particular folder.  When I use my PC you can see info in the folders.

  • Please help me I can't get onto safari, everytime I click it it say safari quit unexpectedly

    Process:               Safari [413] Path:                  /Applications/Safari.app/Contents/MacOS/Safari Identifier:            com.apple.Safari Version:               8.0 (10600.1.25.1) Build Info:            WebBrowser-7600001025001000~1 Code Type

  • [svn:fx-4.x] 15044: Mirroring Window Gripper and DateField bug fixes

    Revision: 15044 Revision: 15044 Author:   [email protected] Date:     2010-03-25 17:15:30 -0700 (Thu, 25 Mar 2010) Log Message: Mirroring Window Gripper and DateField bug fixes http://bugs.adobe.com/jira/browse/SDK-25719 - The gripper does not show u