php - How many SQL Updates functions are too many -


I have a scenario where I have a lot of updates which are done on some text (mostly 64k text types Field, but there are also some medium-text fields, which I think is 4 MB?) Field (essentially, can search and replace those fields).

Here's how I have to do this, but it is not certain that this is the best way.

In general, using PHP and MySQL, I will do something like (SQL code that is not wrapped in PHP code but you get this idea):

  SELECT id, some_text_row from the table, some sometext_row like '% some phrase%'  

could potentially return thousands of rows. Next, I do something like this:

  $ line ['some_text_row'] = str_replace ('some phrases',' some other phrase ', $ line [' Some_text_row ']); Update table some_text_row = "{$ row ['some_text_row']}" WHERE id = "{$ row ['id'] '}" LIMIT 1;  

And as I said, it could be of thousands of updates.

Not for the big experience of this update, I am surprised that there is a better way for this , or if rows of thousands of rows are not really a problem (this case In, the question is how many rows will be a problem).

Thank you.

I am not a SQL expert, but you can see my SQL. They can allow you to do the whole thing in SQL statements (since you are only replacing one).

Something like this:

  UPDATE `table` SET some_text_ur = some (some words, 'some phrase', 'some other phrase'), where 'some Some_text_row like phrase% ';  

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -