Database query remains stuck

  • An SQL Query done by Rankmath keeps calling again and again until the page won’t load anymore and the process has to be stopped manually.

    SELECT wp_posts.ID, wp_posts.post_type FROM wp_posts
      LEFT JOIN wp_postmeta ON ( wp_posts.ID = wp_postmeta.post_id )
      LEFT JOIN wp_postmeta AS mt1 ON ( wp_posts.ID = mt1.post_id )
      LEFT JOIN wp_postmeta AS mt2 ON (wp_posts.ID = mt2.post_id AND mt2.meta_key = 'rank_math_robots' )
      WHERE 1=1
        AND ( wp_postmeta.meta_key = 'rank_math_focus_keyword' AND ( ( mt1.meta_key = 'rank_math_robots' AND mt1.meta_value NOT LIKE '%noindex%' ) OR mt2.post_id IS NULL ) )
        AND wp_posts.post_type IN ('post', 'page', 'attachment', 'products', 'wp_solutions', 'open-positions', 'am_event')
        AND (wp_posts.post_status = 'publish')
        AND wp_posts.post_title NOT REGEXP REPLACE(wp_postmeta.meta_value, ',', '|')
      GROUP BY wp_posts.ID 

    It’s about this call.
    The query remains stuck as a zombie process, so the process can not be shot down after 10 minutes and the database connections are released again

Viewing 6 replies - 1 through 6 (of 6 total)
  • I’m not sure but am I right when I say this query is running in /includes/modules/seo-analysis/seo-analysis/seo-analysis-tests.php on line 263?


    Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.

    Would you mind walking me through some steps that I can take to reproduce this on my end?

    Looking forward to helping you. Thank you.


    The problem is I don’t know exactly why this happens. But the site in question has already been down twice for some time.

    Both times it was about this query which tried to execute over and over again.

    Hi Bastian,

    Thanks for the follow up.

    It is likely that you may be hitting a limit on the max_execution_time that is allowed by your server. Would you mind checking your server logs for the kind of errors that are reported when the SEO analysis is running?

    We are looking forward to helping you. Thank you.

    Server log showed no anomalies. Of course we’ve checked them. We had to check the SQL History to find this. I don’t have insight to the max execution time of the server but i’ve been told it’s already very high.

    Hello @bastian-fiessinger

    Thanks for the additional info.

    Can you confirm that you have WP_Debug enabled for the affected site?

    It would also really help if you could check whether this issue could be stemming from a conflict by performing the steps described on the following page:

    We are looking forward to helping you. Thank you.


    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 6 replies - 1 through 6 (of 6 total)

The ticket ‘Database query remains stuck’ is closed to new replies.