Bad performance on big e-commerce
-
First, thank you very much for this plugin that I’ve been using it for years.
I’ve detected some performance problems when working with a big ecommerce.
I’ve have more than 35.000 active products and about 1.000 discontinued products.
The problem is exclude_discontinued_products function sets all discontinued product ids in post__not_in query arg, which is being translated in sql to wp_posts.ID NOT IN (…..).
This approach does not work well in this context, as it turns a query of 50-80ms into a query of 6-8 seconds.
I tried the same SQL query changing the WHERE clausule by
AND NOT EXISTS (SELECT * FROM wp_postmeta pm WHERE wp_posts.ID = pm.post_id AND meta_key ='_is_discontinued' AND meta_value = 'yes')
and it has substantially improved the performance to 80ms (almost the same time as the original query).You may put this clausule using the posts_where filter
- The topic ‘Bad performance on big e-commerce’ is closed to new replies.