C
C
Chvalov2018-02-15 17:27:58
MySQL
Chvalov, 2018-02-15 17:27:58

How to update more than 500k rows without a long MySQL table lock?

After parsing the price, a very large complex SQL query is executed (UPDATE)
Is it possible to break one large query into many smaller ones?
In laravel -> ORM Eloquent ?
And SpringBoot -> Hibernate(Persistence) ?
In order not to duplicate the question, please give a solution for two different platforms
(Two projects, one problem)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
B
Boris Korobkov, 2018-02-15
@Chvalov

Option 1. Update data in chunks. Blocking will still be, but small.
Option 2. Master-slave replication. Update data on master and read from slave. In this case, the master lock will not prevent data from being read from the slave. As a bonus - increased fault tolerance.

M
Maxim Grishin, 2018-02-15
@vesper-bot

Copy the table that you are going to change to another table, update the data there, rename or transfer the data back. I think so.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question