• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Table Getting Locked while updating a single row

 
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 3837
66
Netbeans IDE Oracle Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Forget this weirdo. You guys wanna see something really neat? I just have to take off my shoe .... (hint: it's a tiny ad)
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic