SELECT Query down My Website

#814037
  • Resolved Ahmed
    Rank Math free

    Hello,
    The website has high load because of mysql when we check we found this query do you have any idea what is this:
    SELECT l.ID, post_title, post_content, post_name, post_parent, post_author, post_modified_gmt, post_date, post_date_gmt, post_type
    FROM (
    SELECT DISTINCT p.ID FROM wp_posts as p
    LEFT JOIN wp_postmeta AS pm ON ( p.ID = pm.post_id AND pm.meta_key = 'rank_math_robots' )
    WHERE (
    ( pm.meta_key = 'rank_math_robots' AND pm.meta_value NOT LIKE '%noindex%' ) OR
    pm.post_id IS NULL
    )
    AND p.post_type = 'post' AND p.post_status IN ( 'publish' ) AND p.post_password = ''
    AND p.ID != ''
    ORDER BY p.post_modified DESC LIMIT 200 OFFSET 19600
    )
    o JOIN wp_posts l ON l.ID = o.ID

Viewing 12 replies - 1 through 12 (of 12 total)
  • Hello,

    I understand your concern about the high load on your website due to a MySQL query. The query you provided seems to be related to Rank Math SEO plugin and is used to fetch posts based on certain criteria related to SEO settings like robots meta tags.

    This query is designed to retrieve posts that meet specific conditions set by the Rank Math plugin, such as excluding posts with a ‘noindex’ meta value. It selects post details like ID, title, content, etc., from the WordPress database tables wp_posts and wp_postmeta.

    If you are experiencing performance issues due to this query, you may consider optimizing your database indexes, ensuring that your server resources are adequate, and checking for any potential conflicts with other plugins or themes.

    If you need further assistance in optimizing this query or resolving performance issues, feel free to provide more details or reach out to our support team by assigning this ticket to a human agent using the available options.

    Thank you for bringing this to our attention. Let me know if you need any more help.

    Sources:
    Resolving Rank Math Schema Markup Related Issues
    Analyzing Your Site’s SEO with Rank Math’s SEO Analysis Tool
    Rank Math Sitemap Issues and Their Fixes » Rank Math

    Ahmed
    Rank Math free

    Please, I need human

    Hello,

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

    Please check the PHP values of your site by heading over to your WordPress dashboard > Tools > Site Health > Info tab > Server. If they are set too low on your site, please ask your hosting provider to upgrade the values according to the following and see if that works for you:

    PHP Memory Limit: 1024M
    Max input time: 150
    PHP time limit: 120
    PHP max input variables: 1000
    

    Let us know how it goes. Looking forward to helping you.

    Thank you.

    Ahmed
    Rank Math free

    What this query for?

    Hello,

    These values are server configurations related to PHP settings that can impact the performance of your website.

    Here is what each value represents:

    PHP Memory Limit: This sets the maximum amount of memory in megabytes that a script can allocate. In this case, it is set to 1024M (1024 megabytes).

    Max Input Time: This sets the maximum time in seconds for a script to parse input data, such as POST and GET. Here it is set to 150 seconds.

    PHP Time Limit: This sets the maximum time in seconds a script is allowed to run. It is set to 120 seconds in this case.

    PHP Max Input Variables: This sets the maximum number of input variables allowed. Here it is set to 1000.

    These values are crucial for the proper functioning of your website, and if they are lower than the recommended values, it can lead to issues like slow loading.

    We hope this provides more clarity and do not hesitate to let us know if you have further questions.

    We are here to help.

    Thank you.

    Hello,

    This query is part of Rank Math’s process to handle post metadata, ensuring that only posts not marked as ‘noindex’ are included in SEO-related tasks like sitemaps. It’s designed to ensure your SEO data is up-to-date and accurate.

    Rank Math is designed to be lightweight and efficient. Under typical conditions, Rank Math queries should not cause significant load issues. If you continue to experience problems, it might be indicative of an underlying issue with server resources, database optimization, or configuration settings.

    Hope that helps, and please do not hesitate to let us know if you need our assistance with anything else.

    Ahmed
    Rank Math free

    This website is big with high traffic. So, it seems your query cause issues what’s your solutions

    Hello,

    That query is required so we can set the correct settings on the pages and make sure the website is getting indexed correctly.

    However, if the postmeta table is very big it would take longer to run this query.

    So, the first step we would recommend is making sure that you remove any orphan entries from that table with a couple of queries like the ones here: https://wpbitz.com/check-and-delete-orphaned-post-meta-in-wordpress/

    That should help bring the table to a more manageable state but if that still doesn’t help, we can recommend the following plugin which will create indexes to help speed up the queries: https://wordpress.org/plugins/index-wp-mysql-for-speed/

    Before using that plugin, we would recommend taking a complete backup of the database that could easily be restored.

    Hope this helps solve your issues.

    Don’t hesitate to get in touch if you have any other questions.

    I have the same problem, this query breaks my website.

    Hello @Marcioamicci,

    Can you share more details about the issues you are experiencing on your site?

    If you want more personalized support you can open a new ticket and share those details with us and we will be delighted to assist you.

    We look forward to hearing back from you.

    Thanks.

    SELECT l.ID, post_title, post_content, post_name, post_parent, post_author, post_modified_gmt, post_date, post_date_gmt, post_type\n FROM (\n SELECT DISTINCT p.ID FROM jbr_posts as p\n \n LEFT JOIN jbr_postmeta AS pm ON ( p.ID = pm.post_id AND pm.meta_key = \’rank_math_robots\’ )\n WHERE (\n ( pm.meta_key = \’rank_math_robots\’ AND pm.meta_value NOT LIKE \’%noindex%\’ ) OR\n pm.post_id IS NULL\n )\n AND p.post_type = \’post\’ AND p.post_status IN ( \’publish\’ ) AND p.post_password = \’\’\n AND p.ID != \’\’\n \n ORDER BY p.post_modified DESC LIMIT 200 OFFSET 1123200\n )\n o JOIN jbr_posts l ON l.ID = o.ID

    This query executes a million times and broke my website, slow down the panel, and i have to restart the database.

    SELECT COUNT( DISTINCT p.ID ) as count FROM jbr_posts as p\n \n LEFT JOIN jbr_postmeta AS pm ON ( p.ID = pm.post_id AND pm.meta_key = \’rank_math_robots\’ )\n WHERE (\n ( pm.meta_key = \’rank_math_robots\’ AND pm.meta_value NOT LIKE \’%noindex%\’ ) OR\n pm.post_id IS NULL\n )\n AND p.post_type = \’post\’ AND p.post_status IN ( \’publish\’ ) AND p.post_password = \’\’\n AND p.ID != \’\”

    Hello,

    Please follow the guide we share here. If you need further help with this, please create a new support ticket so we can investigate it further.

    Thank you for your patience and cooperation

    Hello,

    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 12 replies - 1 through 12 (of 12 total)

The ticket ‘SELECT Query down My Website’ is closed to new replies.