note
grep
There is a not a (practical) programmatic way to speed up that code (without knowing more). But I think you are heading down to [wp://XY_problem] Territory.
<p>
Can you give a clearer spec of what you are really trying to accomplish? <br>Because, I can almost guarantee that copying a set of data from one table to another is not the solution.
<!-- Node text goes above. Div tags should contain sig only -->
<div class="pmsig"><div class="pmsig-133383">
[id://133383|grep]<br \>
<tt>One dead unjugged rabbit fish later...</tt>
</div></div>
674313
674590