• Resolved sujrara

    (@sujrara)


    Hi Folks,

    We are assuming this is a core wordpress issue.
    Repeated update on “options” table ‘WHERE ‘Option_name’ = ‘Rewrite_rules’ – This update is happening on each and every page load thereby increasing the load on DB CPU. Please let us know if this is the default WordPress behavior and how to get rid of this query or mitigate it.

    Here is the query which is causing trouble:
    UPDATE cms_options
    SET option_value = ‘{{Data volume around 0.5MB}}’
    WHERE option_name = ‘rewrite_rules’

    Regards,
    Sujit

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    Ideally it is not normal, but if code somewhere is calling something like flush_rewrite_rules(), then it would be expected. It’s advised to only call such a function upon theme or plugin activation for the very reason that it is computationally very expensive. But I’ve seen lots of code snippets that call such a function in a context where it is called on every page request.

    If you can locate where such a function is called, it would be safe to comment it out on your site assuming it has already been called once for the current configuration. It will be reinstated though when the offending plugin or theme is updated. If a published theme or plugin is doing this, it would be helpful to all if the responsible author were told they are Doing it Wrong?

    Thread Starter sujrara

    (@sujrara)

    @bcworkz Thank you so much. We were able to find “flush_rewrite_rules()” in the code and by removing this code, the issue is resolved and update not occurring now. Greatly appreciate your timely support.

    Best Regards,
    Sujit

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Rewrite_rules sql query causing DB spike’ is closed to new replies.