RE: When using "FOR UPDATE" whole the table seems to lock instead of selected row

2010-01-18 Thread Gavin Towey
e/part_3.html -Original Message- From: phark...@gmail.com [mailto:phark...@gmail.com] On Behalf Of Perrin Harkins Sent: Friday, January 15, 2010 6:08 AM To: Johan Machielse Cc: Baron Schwartz; mysql@lists.mysql.com Subject: Re: When using "FOR UPDATE" whole the table seems to lo

Re: When using "FOR UPDATE" whole the table seems to lock instead of selected row

2010-01-15 Thread Perrin Harkins
On Fri, Jan 15, 2010 at 2:54 AM, Johan Machielse wrote: > The problem is that multiple users can read and update the same field > simultaneously (worse case) which could lead to unpredictable problems. There are other ways to do handle most cases. For example: UPDATE table SET value = value + 1

Re: When using "FOR UPDATE" whole the table seems to lock instead of selected row

2010-01-14 Thread Johan Machielse
such a problem? Thank you in advance. Regards, Johan Machielse - Original Message - From: "Baron Schwartz" To: "Johan Machielse" Cc: Sent: Friday, January 15, 2010 3:14 AM Subject: Re: When using "FOR UPDATE" whole the table seems to lock instead of s

Re: When using "FOR UPDATE" whole the table seems to lock instead of selected row

2010-01-14 Thread Baron Schwartz
Johan, I don't see a valid need for using FOR UPDATE here. In fact, FOR UPDATE is the cause of many grievances, and I would advise you to avoid it by any means possible. Among other things, it will cause serious performance problems when your server gets busy. And as you can see, it's hard to f

When using "FOR UPDATE" whole the table seems to lock instead of selected row

2010-01-14 Thread Johan Machielse
Hi, I have created a query to read and update a stock item by using the FOR UPDATE statement. According to the MySql documention only the rows that are selected using the FOR UPDATE should be locked for other sessions, but somehow whole the table is locked. This post gives some general informat