Optimise Product Attributes Lookup
WooCommerce keeps a product attribute lookup table to make filtering and faceted searches fast. That table needs regenerating from time to time, and the regeneration runs in the background through cron and Action Scheduler. The trouble is in the query WooCommerce builds while it does this. It can end up checking both product_id and product_or_parent_id for the same value joined with an OR. An OR across two columns like that stops MySQL using its index efficiently, so instead of a quick indexed lookup you get a much heavier scan, and on a large catalogue that makes the regeneration far slower than it needs to be.
The Optimize Product Attributes Lookup option spots the case where both product_id and product_or_parent_id refer to the same id. When they do, the product_id clause is redundant – it’s asking the same question twice – so the option removes it. With the redundant clause gone the query is a straightforward single-column lookup, and MySQL can use the index properly again.
This runs where the work actually happens: during the background attribute lookup regeneration driven by cron and Action Scheduler. You don’t need to trigger anything by hand, the optimisation applies to the regeneration as it runs.
You’ll find this in the Imports tab under "Optimize Product Attributes Lookup".
In short: WooCommerce’s attribute lookup regeneration can build an OR across product_id and product_or_parent_id that stops MySQL using the index. When both point at the same id this option drops the redundant product_id clause so the query uses the index again, speeding up the background regeneration on large catalogues.