_get_list_table taking 4 seconds to load
-
Hi,
My WooCommerce page is very slow as there is some slow queries being triggered.
I am not able to fix this class function as it is taking more than 4 seconds just to calculate count.
Backtrace:
WP_Posts_List_Table->__construct
_get_list_tableQuery
SELECT COUNT( 1 ) FROM wp_posts WHERE post_type = 'shop_order' AND post_status NOT IN ( 'trash','auto-draft','inherit','request-pending','request-confirmed','request-failed','request-completed','dp-rewrite-republish' ) AND post_author = 1Time Taken by this Query: 4.1015 Seconds
I have done optimisation with this wordpress query but I am not able to override the above function.
Optimised Query
SELECT SUM(temp.num_posts) as total FROM (SELECT post_status, COUNT( * ) AS num_posts FROM wp_posts WHERE post_type = 'shop_order' AND post_status = "wc-cancelled" UNION ALL SELECT post_status, COUNT( * ) AS num_posts FROM wp_posts WHERE post_type = 'shop_order' AND post_status = "wc-completed" UNION ALL SELECT post_status, COUNT( * ) AS num_posts FROM wp_posts WHERE post_type = 'shop_order' AND post_status = "wc-pending" UNION ALL SELECT post_status, COUNT( * ) AS num_posts FROM wp_posts WHERE post_type = 'shop_order' AND post_status = "wc-on-hold" UNION ALL SELECT post_status, COUNT( * ) AS num_posts FROM wp_posts WHERE post_type = 'shop_order' AND post_status = "wc-refunded") as tempTime Taken by this Query: 950ms Seconds
Time taken is way better than what we already have with wordpress, Is there a way to override this function and optimise it according to above query.
The page I need help with: [log in to see the link]
The topic ‘_get_list_table taking 4 seconds to load’ is closed to new replies.