MySQL Forums
Forum List  »  Connector/JDBC and Java

Re: Slow Concurrent Updates
Posted by: Filipe Silva
Date: July 31, 2017 10:36AM

Hi Felix,

Using RAND() to avoid locking issues is not a good idea. It may work when there are a lot of null request_guid rows but when those start to run low you will hit the locking issues again for sure.

You should use some locking mechanism in the row you want to update. Use transactions, locking reads or whatever. (https://dev.mysql.com/doc/refman/5.7/en/innodb-locking-reads.html)

As for an efficient way of choosing a random row this article may help you: http://jan.kneschke.de/projects/mysql/order-by-rand/.

IHTH

Options: ReplyQuote


Subject
Written By
Posted
July 31, 2017 02:31AM
Re: Slow Concurrent Updates
July 31, 2017 10:36AM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.