Better way to remove HTML syntax from all content

If you just need to change the post content, you can avoid the overhead of get_posts/WP_Query by directly querying the database:

global $wpdb;

$results = $wpdb->get_results("SELECT ID, post_content FROM {$wpdb->posts}");

$total = count($results); 
$changed = 0;

foreach($results as $entry){

  $new_content = strip_tags($entry->post_content, '<img><a>');

  if($entry->post_content !== $new_content){

    $wpdb->query($wpdb->prepare(
                 "UPDATE {$wpdb->posts} SET post_content = %s WHERE ID = %s)", 
                    $new_content, $entry->ID));

    $changed++;
  }

}

printf("Changed %d out of %d posts", $changed, $total);

(back-up db first)