Slow Query Execution with derived_merge=on (the default)
-
The query located in
./woocommerce-ajax-filters/includes/faster_recount.php
( https://dpaste.com/4EKV44F8Y ) performs poorly when the MySQL optimizer optionderived_merge
is enabled (default setting). The execution takes several minutes to complete.When
derived_merge
is disabled (SET optimizer_switch='derived_merge=off'
), the query completes in approximately 3 seconds.However, disabling
derived_merge
globally in my.cnf (optimizer_switch=derived_merge=off) causes a significant slowdown for other WordPress-related queries, such as WooCommerce REST API calls (e.g.,GET /wp-json/wc/v3/products
), which perform optimally whenderived_merge
is enabled.Is any way before you run the query to have something like this?
SET SESSION optimizer_switch=’derived_merge=off’
- The topic ‘Slow Query Execution with derived_merge=on (the default)’ is closed to new replies.