Slow SQL requests
-
Hi! I use 3.1.3 plugin version with WP 5.6 and observe plugin slowness – it adds to to 2-3 seconds to the page load.
With query monitor I found this is due to SQL requests in the function get_popular_posts()
SELECT ID, post_title as title, post_type, post_date, post_author, ttt.cntaccess as total_count, SUM(ttd.cntaccess) as daily_count
FROM wp_top_ten AS ttt
INNER JOIN wp_posts
ON ttt.postnumber=ID
LEFT JOIN (
SELECT *
FROM wp_top_ten_daily AS ttd
WHERE DATE(ttd.dp_date) >= DATE(‘2023-09-25’)
AND DATE(ttd.dp_date) <= DATE(‘2023-09-25’) ) AS ttd
ON ttt.postnumber=ttd.postnumber
WHERE 1=1
AND ttt.blog_id = 1
AND (wp_posts.post_status = ‘publish’
OR wp_posts.post_status = ‘inherit’)
AND (wp_posts.post_type <> ‘revision’ )
GROUP BY ID
ORDER BY daily_count DESC
LIMIT 0, 10
I can also see that this function is called twice in page. WP Super Cache and Object cache are installed and object cache hit is around 99% but somehow this requets is out of it.
Can this be optmized / fixed please?
The topic ‘Slow SQL requests’ is closed to new replies.