Thanks for the upload. The first two queries in the monitor you showed me are related to that Simple Download Monitor. The first one reads all the rows (!!! why?) in the wp_sdm_downloads table, and takes almost a quarter-second each time it runs. The second one reads all the records for a particular post, and takes 0.066 seconds each time. Is it possible your site has logged a great many downloads, particularly for post_id 4443? Is it possible you should delete old historical records from that table? (It is still sloppy programming on the part of the plugin developer to write SELECT * FROM table
queries, and probably means they didn’t anticipate working with a site as busy as yours.)
XXXX Please see the next post. You could delete historical records over a year old from that table with wp-cli:
xxxx wp db query "DELETE FROM NHQ2wp_sdm_downloads WHERE date_time < NOW() - INTERVAL 1 YEAR"
There aren’t any indexes on that table. The second query would speed up a bit if you added an index on post_id. To do this with wp-cli:
wp db query "ALTER TABLE NHQ2wp_sdm_downloads ADD KEY post_id(post_id)"
Other queries seem to be ordinary WordPress category searches and so forth.
I think it’s possible a persistent object cache will help make things faster? Worth a try! https://developer.www.ads-software.com/reference/classes/wp_object_cache/#persistent-cache-plugins
I didn’t add any indexes to wp_term_taxonomy or wp_term_relationships because the standard indexes on those tables looked to me like they were the best possible. I’d be delighted if you put some of your slow-query-log queries in here, so I can take another look at that decision.
-
This reply was modified 6 months, 2 weeks ago by OllieJones.