• I am troubleshooting some performance issues with my site. In doing so I have just uncovered a rather alarming issue.

    The number of underlying queries to the database goes through the roof when I have SEOPress active. Specifically, the page I am using to research this goes from 141 SELEECT queries (with SEOPress not running) to well over 1400 when SEOPress is enabled. The majority of the queries are similar to the one below.

    I suspect this could have something to do with LifterLMS (I am going to ask there too), which registers it’s own CPTs. But, as I say, if I deactivate SEOPress this issue goes away.

    This is a pretty concerning issue and, for now, I have deactivated SEOPress. I’d appreciate any thoughts and suggestions.

    Note : this happens even if I only have the free plugin activated.

    SELECT SQL_CALC_FOUND_ROWS wp_posts.*
    FROM wp_posts
    INNER JOIN wp_postmeta
    ON ( wp_posts.ID = wp_postmeta.post_id )
    INNER JOIN wp_postmeta AS mt1
    ON ( wp_posts.ID = mt1.post_id )
    WHERE 1=1
    AND ( wp_postmeta.meta_key = '_llms_order'
    AND ( ( mt1.meta_key = '_llms_parent_section'
    AND mt1.meta_value = '2875' ) ) )
    AND wp_posts.post_type = 'lesson'
    AND (wp_posts.post_status = 'publish'
    OR wp_posts.post_status = 'acf-disabled'
    OR wp_posts.post_status = 'xlwctydisabled'
    OR wp_posts.post_status = 'llms-completed'
    OR wp_posts.post_status = 'llms-active'
    OR wp_posts.post_status = 'llms-expired'
    OR wp_posts.post_status = 'llms-on-hold'
    OR wp_posts.post_status = 'llms-pending-cancel'
    OR wp_posts.post_status = 'llms-pending'
    OR wp_posts.post_status = 'llms-cancelled'
    OR wp_posts.post_status = 'llms-refunded'
    OR wp_posts.post_status = 'llms-failed'
    OR wp_posts.post_status = 'llms-txn-failed'
    OR wp_posts.post_status = 'llms-txn-pending'
    OR wp_posts.post_status = 'llms-txn-refunded'
    OR wp_posts.post_status = 'llms-txn-succeeded'
    OR wp_posts.post_status = 'private')
    GROUP BY wp_posts.ID
    ORDER BY wp_postmeta.meta_value+0 ASC
    LIMIT 0, 500
Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter markwill

    (@markwill)

    I have been trying to narrow this down and have it down to a single line of code, from my plugin. I used LifterLMS and a single call to this function results in 27 extra database calls when SEOPress is activated. If I simply deactivate SEOPress then those 27 database calls go away.

    https://developer.lifterlms.com/reference/classes/llms_course/get_sections/

    This behavior, likely replicated across a number of calls to the LifterLMS API, probably explains why the number of database calls increases by more than 500 on one of my key pages, merely by activating SEOPress (no other changes).

    I am very eager to understand how activating SEOPress can have such an impact.

    • This reply was modified 3 years, 4 months ago by markwill.

    Hi Mark,

    Thank you for reaching out to us and sorry you’re facing this issue.

    Can you please reachout to the LifterLMS development team concerning this issue? You can join the #developers channel on our Slack Community.

    A member of the engineering team would get in touch with you as soon as possible.

    Regards,`

    Plugin Author Benjamin Denis

    (@rainbowgeek)

    Hi @markwill

    can you share the URL of your page with the issue please?

    Do you use the free version or the PRO version of LifterLMS?

    Do you use Query Monitor (free plugin) to debug this?

    Thread Starter markwill

    (@markwill)

    Thank you for the response, Benjamin. Yes, Query Monitor is how I noticed this issue.

    I have opened a ticket for this and included further information. The following query is being made 13 times (in my test, at least) when I have BOTH SEOPress (free or Pro) and Oxygen. The post in question is a LifterLMS course.

    SELECT * FROM wp_posts WHERE ID = 1261 LIMIT 1

    Multiplied across a number of methods in my production code and I see hundreds/thousands of extra calls on a single page.

    That does not happen if I disable either of those plugins – this query is made just once.

    As I reported in my ticket, I narrowed this down to 2 lines of code (happy to share access via the ticket, if needed). I do not believe this is a LifterLMS issue though.

    $new_course = new LLMS_Course(1261);
    $course_sections = $new_course->get_sections(‘sections’);

    Thank you.

    • This reply was modified 3 years, 4 months ago by markwill.
    Thread Starter markwill

    (@markwill)

    A little more detail…

    The extra / duplicated calls are initiated by a code path that includes the following…

    apply_filters(‘seopress_titles_template_replace_array’)
    include(‘/plugins/wp-seopress/inc/functions/variables/dynamic-variables.php’)

    Note that, as far as I can tell, these extra calls ONLY happen when Oxygen is running at the same time as SEOPress. Deactivate either and I am back to a single query.

    Plugin Author Benjamin Denis

    (@rainbowgeek)

    May I know if you have checked any options from SEO, Tools, Compatibility Center tab? If it’s the case, disable them.

    This is something that will get deprecated soon in a future update.

    Thread Starter markwill

    (@markwill)

    Thank you for the response, Benjamin. I do not have any of the options under Compatibility Mode checked.

    At this stage and with tickets opened with LifterLMS, Oxygen and SEOPress, I think we can discount LifterLMS from our investigations. Use of the LifterLMS API reasonably often on a single page was where this was exposed, but I am seeing this across many aspects of my site, including on pages where LifterLMS is not involved.

    The problem seems to be something to do with the interaction between Oxygen and SEOPress. As I mentioned, disabling either one resolves this issue. I have the option to deactivate SEOPress (that is what I have done for now) but not Oxygen, since my site is built with it.

    The Oxygen team seems to think this is something to do with SEOPress’ support for Oxygen. They made this comment…

    “I’ve seen something similar with SEOPress in the past where the number of calls was largely increased once it was activated, and I think it’s something to do with how their Oxygen integration works.”

    The end result can be rather dramatic, with the number of database queries increasing by almost 10x (with both plugins running), compared to when SEOPress is deactivated.

    I welcome your thoughts. Thank you.

    • This reply was modified 3 years, 4 months ago by markwill.
    • This reply was modified 3 years, 4 months ago by markwill.
    Thread Starter markwill

    (@markwill)

    According to some discussions I have with one or two folks in the Oxygen Facebook group this SEEMS like it is related to how SEOPress is handling CPTs.

    On a simple test page that creates a single instance of a lesson I see this call (1261 is the post ID for the lesson, which is a LifterLMS CPT)

    SELECT * FROM wp_posts WHERE ID = 1261 LIMIT 1

    That appears just once when either SEOPress or Oxygen are deactivated. However, when I activate both, that single query happens 13 times. Each call is associated with the SEOPress filter I mentioned above.

    I asked another person to test on his own site. When he did so on a page that used a different CPT (nothing to do with LifterLMS) he saw the same i.e. the database query was called many times. So that seems like a big clue.

    Any news for this @markwill?

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Huge increase in queries with SEOPress enabled’ is closed to new replies.