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

Thread: Lock questions - Very urgent

  1. #1
    Join Date
    Jun 2000
    Location
    chennai,tamil nadu,india
    Posts
    159

    Lock questions - Very urgent

    I have a table with 10 records.

    i have 10 process that runs at the same time which has the sql as below.

    select * from x where x.a=(select min(a) from x) for update nowait;


    Now the problem here is since row exclusive lock put by one process that causes exception and the requirement is when a lock is placed on one record,the min function should work fine with the rest of the rows leaving the one selected.Is there any way to ignore the locked row and work with the remaining or is there any kind of workarounds.

    You feedback is appreciated.

  2. #2
    Join Date
    Mar 2007
    Location
    Ft. Lauderdale, FL
    Posts
    3,555
    Ten rows in your table and ten concurrent sessions trying to update them? That's what I would call an ugly app design.

    Answering your question...
    Yes, you can minimize your nightmare.
    Take out the [NOWAIT] parameter and include the [OF columns] one.
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.

  3. #3
    Join Date
    Sep 2002
    Location
    England
    Posts
    7,334
    no, you are asking for a lock everytime - remove the for update

  4. #4
    Join Date
    May 2000
    Location
    ATLANTA, GA, USA
    Posts
    3,135
    How about waiting for 5 seocnds ...
    select * from test a
    where a.id = (select min(id) from test) for update wait 5
    /
    Last edited by tamilselvan; 05-09-2008 at 11:39 AM.

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