• 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?

Viewing 1 replies (of 1 total)
  • Plugin Author Ajay

    (@ajay)

    Hi @hardoman, sorry for the delayed response. I missed this thread.

    There are two issues I can see on this. One is that the daily table has grown quite large. Do you have the maintenance mode enabled? This removes entries older than 180 days from the daily table.

    Another issue is that the indexes might be missing from the tables. You can try to regenerate this in the Tools page. I suggest backing up the database tables before making any changes.

    Also, please turn on the plugin’s caching in case you haven’t done so already.

    • This reply was modified 1 year, 1 month ago by Ajay.
Viewing 1 replies (of 1 total)
  • The topic ‘Slow SQL requests’ is closed to new replies.