I have a scenario where I have an inordinate number of updates that have to be performed on some text (mostly 64k text type fields, but potentially some mediumtext fields as well, which I think can contain 4MB?) fields (essentially, a search and replace on those fields).
Here is how I know how to do it, but am unsure if this is the best approach.
Using PHP and MySql, in general, I would do something like this (SQL code not wrapped into PHP code, but you get the idea):
SELECT id, some_text_row FROM table WHERE some_text_row LIKE '%some phrase%'
This could potentially return tens of thousands of rows.
Next, I would do something like this:
$row['some_text_row'] = str_replace( 'some phrase',
'some other phrase',
$row['some_text_row'] );
UPDATE table
SET some_text_row = "{$row['some_text_row']}"
WHERE id="{$row['id']'}"
LIMIT 1;
And as I said, this may be tens of thousands of updates.
Not having the experience for this large of an update, I am wondering if there is a better approach to this, or, if tens-of-thousands of rows is not really an issue (in which case, the question is, how many rows would be an issue).
Thanks.