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.
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.
no, you are asking for a lock everytime - remove the for update
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.
Click Here to Expand Forum to Full Width