title: Fastest way to search MySQL Text for multiple terms: MySQL vs Python
body: <p>I have a database with 700 million rows (each with a <code>TEXT</code> field) and 500+ search terms. What is the fastest way to find all rows that contain at least one search term and insert them into a new table?</p>
  
  <p>My first thought was to use the following </p>
  
  <pre><code>INSERT INTO my_new_table
      SELECT * FROM my_table WHERE text_field LIKE '%term1%' OR ... OR text_field LIKE '%term500%';
  </code></pre>
  
  <p>Or would Python be faster, with something like</p>
  
  <pre><code>cursor.execute("SELECT * FROM mytable")
  for row in cursor:
      if any(term in row[text_index] for term in search_terms):
          write_row_to_csv_or_mysql(row)
  </code></pre>
  
  <p>Or maybe there is a better way?</p>