Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Table Getting Locked while updating a single row

 
Vaibhav G Garg
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

We are having a code where we are updating the rows in a column based on a simple single where condition. Now, the code is in production but it is found that it locks the whole table sometimes. Please suggest how to prevent the table from being locked.

We are just updating a single row but yes there are multiple users of the application.

Thanks
 
Martin Vajsar
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure the update is locking it? Have you used some database tools to identify the offending transaction/statement? There could be some other, overlooked process that is locking the table (eg. deleting a row from a parent table might lock the child table if it doesn't have its foreign key indexed).

Assuming it is the update operation, it might be caused by lock escalation. The details of locking are database dependent. Some databases don't ever escalate locks, while others do, under different conditions. I'd suggest to consult your database documentation to find out why, when and how a lock escalation can occur.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic