- ChatGPT really sucks at SQL - August 9, 2024
- We’ve launched our newsletter again - July 24, 2024
- Full Hello Elementor and Elementor Pro FSE compatibility added for Super Speedy Filters - May 30, 2024
If you have a large site, you probably noticed wp-admin slowing down a lot with the later versions of WooCommerce. WooCommerce have been working towards optimising their code, but they still leave some gremlins in there.
In this case, they have a piece of code which checks to see if ‘products exist’ already to determine whether some onboarding stuff should be called or not.
The mistake they make is that they use WP_Query to fetch 1 product and WP_Query will sort the products by date by default. They don’t actually care about the order, they only care if at least one product exists.
Table of Contents
How slow WooCommerce wp-admin looks on a large website
I am not talking about trivial performance issues here – on my demo site with 820,000 products, this piece of badly written code consumes 30 to 70 seconds of database time when there is actually no need to sort the products by date.
![First page load of wp-admin with WooCommerce onboarding code causing slow performance.](https://www.superspeedyplugins.com/assets/image-164-1.png)
Things are not quite as bad once the database has cached the data – it can sort ‘quickly’ in RAM. But as readers will know, I don’t consider 30 to 170 seconds to be anywhere near fast.
How fast WooCommerce wp-admin becomes after the speed fix is applied
With the fix applied, the speed of wp-admin drops back to very acceptable levels – the query that previously took 30 to 170 seconds now takes 0.0159 seconds which is basically instant.
![WooCommerce wp-admin speed improves from 170 seconds to 0.0159 seconds after WooCommerce onboarding performance boost.](https://www.superspeedyplugins.com/assets/image-165-1.png)
Other performance boosts added to Scalability Pro
This round of enhancements also brings a boost to bulk editing. You may already have this boost if you use our Defer Term Counting until night time feature, but if you don’t then our new feature automatically defers term counting when you bulk edit until after all items in the bulk edit have been edited.
In future, I plan to add additional items into this bulk editing speed boost, e.g. to queue up actions which are added to save_post – these are often expensive for my clients e.g. when bulk updating orders then causes sending email, updating Amazon stock or eBay stock, updating a CRM system, communicating with Trello etc. By queueing up these items, admins can bulk update items and get back to what they were doing without waiting for these tasks to complete. They will be queued to complete in the background.
I’ve also added a performance improvement for those with many media files. Now, wp-admin will cache the months and years of your media files for one day, so if your wp-admin is slow because of the media-files query now it will only be slow for one view per day.
The media files query looks like this in Query Monitor:
SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month
FROM wp_posts
WHERE post_type = 'attachment'
ORDER BY post_date DESC
All of these speed boosts have been added to Scalability Pro 4.83. Get Scalability Pro here.