|
-
 Originally Posted by sumit
I am using a "select for update" with order by clause which is getting a deadlock. I was expecting that adding an order by should never lead to a deadlock, assuming the rows selected FOR UPDATE are locked in the order as
they are returned.
But is that true? Are the rows selected FOR UPDATE locked in the same
order as they are returned (as specified in ORDER BY)? If yes, why am I getting a deadlock?
P.S: transactions are getting committed by each session after 100 records (1 commit on each 100 records).
Is "select for update" populating a cursor?
In the affirmative case, since locks are held for the duration of the transaction, when using an explicit cursor and "for update" option you should not commit across fecthes.
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|