Bookmark Topic Watch Topic
  • New Topic

Table Getting Locked While Updating a Single Row  RSS feed

 
Vaibhav G Garg
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • 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
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Report post to moderator
Vaibhav G Garg wrote: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.

1. Is this a Java question? Because you've come to a Java forum.
2. Without a lot more information (not the least of which is: what db are you using?) it's impossible to answer. There are any number of strategies that you might use, just one of which is not to update until you KNOW that you need to.
3. Another might be to examine the database's locking strategy. Maybe it's too pessimistic.

Whatever, I suspect this is probably the wrong forum; but without more info it's difficult to know exactly where it should go.

Winston
 
Paul Clapham
Sheriff
Posts: 22831
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Report post to moderator
I was going to move it to JDBC but then I noticed there was already a duplicate copy of this post there already. So I'll just close this one.
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!