I need replace string1 to string2 in column big tabe.
My table weight 1.7GB. For update I will be use:
UPDATE table
SET column
= REPLACE( column, 'search', 'replace' ) ;
So, I have several questions:
- Will table lock during procedure? Should I hide public part my site or not?
- How long time this procedure can executing?
- How better run this? Maybe 'screen'? if my ssh connection will closed.
Mysql 5.5.53
asked Jun 15, 2017 at 21:51
Pavel GromovPavel Gromov
-
Regarding your first question: Which storage engine are you using? I ask because with the LOW_PRIORITY modifier, execution of the UPDATE is delayed until no other clients are reading from the table. This affects only storage engines that use only table-level locking (such as MyISAM, MEMORY, and MERGE).KXNV-89.1FM– KXNV-89.1FM2017年06月19日 14:21:48 +00:00Commented Jun 19, 2017 at 14:21
1 Answer 1
See http://mysql.rjweb.org/doc.php/deletebig#deleting_in_chunks for a technique of chunking a table. It is aimed at DELETE
, but can easily be adapted to UPDATE
.
This should avoid the timeouts and hangs.
answered Jun 29, 2017 at 5:12
lang-sql