The site I am working on used to keep some data in posts meta. It is a WooCommerce site and the data was kept in products variations and fields names look like _field_name where 12345 is a variation id.
That caused bloating of import/export files and creating a lot of rows in the database and the meta fields which keep this data now look like __field_name.
Now I am looking for a simple (which will not take long to implement) solution to remove the fields like _field_name from all the variations.
However, there are quite a lot of products on the site and just looping through all the products, each variation of each product and make delete_post_meta($variation_id) is not an option because we will run out of memory or time limit. Making an AJAX-based function which will break queries with a timeout does not fit the simple solution criteria.
Can you please give me another idea of cleaning this mess?