← Back to team overview

maria-discuss team mailing list archive

Re: Deadlock on update with same values.



For those with the same problem, I found a completely stupid solution, which 

update user set lastlogin = IF(lastlogin != NOW(),NOW(),NOW()) where 

For those now knowing what IF does...

If lastlogin is not NOW() update it and set it to NOW() else set it to NOW()

Well actualy this does exactly the same as 
update user set lastlogin = NOW()
but surprisingly does not lead to the deadlock error, if lastlogin is already 

Mit freundlichen Grüssen

Benoit Panizzon
I m p r o W a r e   A G    -    

Zurlindenstrasse 29             Tel  +41 61 826 93 07
CH-4133 Pratteln                Fax  +41 61 826 93 02
Schweiz                         Web  http://www.imp.ch

Follow ups