DBAsupport.com Forums - Powered by vBulletin
Results 1 to 5 of 5

Thread: Locking Problem

  1. #1
    Join Date
    Sep 2000
    Posts
    77
    I have a pl/sql code which runs a cursor looking for a particular status_cd column in table A.
    In order to speed up response time we are running same code
    from 4 java threads . In the code we open the cursor and fetch a row and and retreiving the primary key and we are querying the same table that was used in the cursor and we are locking that row by using SELECT FOR UPDATE NOWAIT.

    By this we want to ensure that all 4 processes run in parallel and pick up a seperate row from the result set and so that we can finish processing fairly quick.

    We are commiting only after the processing the locked row, so that status_cd will be changed and lock will be released.

    But for some reason eventhough I am locking the row the other processes are picking up the same row at exactly same time. How can ensure that no other process picks up the same row which I have locked using SELECT FOR UPDATE NOWAIT.

    Please Advise
    Thanks

  2. #2
    Join Date
    Jul 2000
    Posts
    521
    make sure that your cursor definition is not doing a full scan...
    svk

  3. #3
    Join Date
    Sep 2000
    Posts
    77
    My cursor is selecting only 50 rows at a time.
    Thanks

  4. #4
    Join Date
    Jul 2000
    Posts
    521
    "How many" is not important. "How" is important.

    Can you please post you cursor def ? Also the indexes on your table ?
    svk

  5. #5
    Join Date
    Feb 2001
    Posts
    389
    select for update makes the process to run serially and not parallel,
    until the first process is commited or rolled back the next process shall not run.
    How r u making sure that each thread is accessing different set of rows, and i think since u r
    updating the primary key , the differentitation shall be dificult.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width