• Resolved darkf3d3

    (@darkf3d3)


    I just installed query monitor wp plugin, and what I found out that on post page there are 7 slow queries related to Contextual Related Posts plugin (i’m showing 6 related post). No other slow queries of wordpress or any other pluging, so it’s not a server performance issue.
    Here’s the slow queries:

    SELECT wp_posts.*, MATCH (wp_posts.post_title,wp_posts.post_content) AGAINST ('>>>>>> POST CONTENT <<<<<<') as score
    FROM wp_posts
    WHERE 1=1
    AND ( ( wp_posts.post_date >= '2012-02-20 00:00:00'
    AND wp_posts.post_date <= '2022-02-17 15:10:45' ) )
    AND wp_posts.ID NOT IN (97709)
    AND wp_posts.post_type = 'post'
    AND ((wp_posts.post_status = 'publish'
    OR wp_posts.post_status = 'inherit'))
    AND MATCH (wp_posts.post_title,wp_posts.post_content) AGAINST ('>>>>>> POST CONTENT <<<<<<')
    ORDER BY score DESC
    LIMIT 0, 6	
    WP_Query->get_posts()
    Plugin: contextual-related-posts	6	0,1559
    SELECT wposts.ID
    FROM wp_posts wposts, wp_postmeta wpostmeta
    WHERE wposts.ID = wpostmeta.post_id
    AND wpostmeta.meta_key = '_wp_attached_file'
    AND wpostmeta.meta_value = '2020/02/aaaaaa.jpg'
    AND wposts.post_type = 'attachment'	
    crp_get_attachment_id_from_url()
    Plugin: contextual-related-posts	1	0,0648
    SELECT wposts.ID
    FROM wp_posts wposts, wp_postmeta wpostmeta
    WHERE wposts.ID = wpostmeta.post_id
    AND wpostmeta.meta_key = '_wp_attached_file'
    AND wpostmeta.meta_value = '2017/04/bbbbbb.jpg'
    AND wposts.post_type = 'attachment'	
    crp_get_attachment_id_from_url()
    Plugin: contextual-related-posts	1	0,0708
    SELECT wposts.ID
    FROM wp_posts wposts, wp_postmeta wpostmeta
    WHERE wposts.ID = wpostmeta.post_id
    AND wpostmeta.meta_key = '_wp_attached_file'
    AND wpostmeta.meta_value = '2020/02/cccccc.jpg'
    AND wposts.post_type = 'attachment'	
    crp_get_attachment_id_from_url()
    Plugin: contextual-related-posts	1	0,0690
    SELECT wposts.ID
    FROM wp_posts wposts, wp_postmeta wpostmeta
    WHERE wposts.ID = wpostmeta.post_id
    AND wpostmeta.meta_key = '_wp_attached_file'
    AND wpostmeta.meta_value = '2015/01/dddddd.jpg'
    AND wposts.post_type = 'attachment'	
    crp_get_attachment_id_from_url()
    Plugin: contextual-related-posts	1	0,0737
    SELECT wposts.ID
    FROM wp_posts wposts, wp_postmeta wpostmeta
    WHERE wposts.ID = wpostmeta.post_id
    AND wpostmeta.meta_key = '_wp_attached_file'
    AND wpostmeta.meta_value = '2019/08/eeeeee.jpg'
    AND wposts.post_type = 'attachment'	
    crp_get_attachment_id_from_url()
    Plugin: contextual-related-posts	1	0,0808
    SELECT wposts.ID
    FROM wp_posts wposts, wp_postmeta wpostmeta
    WHERE wposts.ID = wpostmeta.post_id
    AND wpostmeta.meta_key = '_wp_attached_file'
    AND wpostmeta.meta_value = '2016/10/ffffff.jpg'
    AND wposts.post_type = 'attachment'

    There’s a way to avoid this?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Ajay

    (@ajay)

    The first one being slow, I understand and expect. Are you also getting slow queries for the rest?

    You can enable the plugins inbuilt caching – Cache HTML mode and after the first load, the queries will be reduced to 1-2 which should be significantly faster

    Thread Starter darkf3d3

    (@darkf3d3)

    No, the slow query was only the one i sent you.
    Now with “Cache HTML output” setting enabled, on the second page load the plugin show 0 slow queries.

    Thread Starter darkf3d3

    (@darkf3d3)

    Thank you

    Plugin Author Ajay

    (@ajay)

    @darkf3d3

    Thanks for confirming. Note that you’ll notice that there will be occasional slow queries but only when the plugin is refreshing the posts (default is monthly).

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Slow queries’ is closed to new replies.