Oo Dee
Oo Dee

Reputation: 145

Does MySQL update the same row one at a time?

If I run ten update queries like this, at the exact same time:

update table set x = x - 1 where x >= 1 

Does MySQL, under repeatable-read mode, guarantee that all these update queries are run one at a time, as opposed to in parallel (all at the same time)?

P.S: Does the where clause have any impact on whether it is run in a parallel or sequential style?

Upvotes: 1

Views: 1585

Answers (1)

Srikanth Balaji
Srikanth Balaji

Reputation: 2718

It will be sequential, Table/records will be locked until a given update is complete - Please read below

For storage engines such as MyISAM that actually execute table-level locks when executing DML or DDL statements, such a statement in older versions of MySQL (5.6.5 and earlier)that affected a partitioned table imposed a lock on the table as a whole; that is, all partitions were locked until the statement was finished

More details here - Partition and locking in mysql

Upvotes: 1

Related Questions