• staipa

    (@staipa)


    Hello,
    I’m using your Quotes Llama plugin on a WordPress website and noticed through Query Monitor that a relatively heavy SQL query is being executed even on pages where the plugin is not in use — including the homepage.

    Specifically, the following query is triggered:

    sqlCopia

    Modifica

    SELECT * FROM wp_quotes_llama

    It is called by Quotes_Llama\QuotesLlama->select_all() and fetches over 100 rows, even on pages where no shortcode or plugin content is present.

    This behavior is negatively affecting performance, particularly during page cache generation (I’m using WP Fastest Cache), increasing server load unnecessarily.

    A few suggestions that might help:

    • Load data conditionally, only when the plugin is actually needed (e.g. when a shortcode is present).
    • Avoid using SELECT * where possible — fetching only required fields or adding a LIMIT clause would be more efficient.
    • Consider checking whether select_all() is being called too early (e.g. globally during init) and limiting it to relevant contexts.

    Thank you in advance for your support. I’d be happy to provide logs or further technical details if needed.

    Best regards

Viewing 1 replies (of 1 total)
  • Plugin Author oooorgle

    (@oooorgle)

    Hi Staipa,
    I am working towards an acceptable solution between reasonable datasets vs. excessive .ajax calls, and like you mentioned limiting it to relevant contexts is posing a problem at the moment.. Still working on it when I can find the time. Getting the data to JavaScript later is at the forefront. Having it load regardless of short_code is definitely not good and I missed that when changing from .ajax to the select query. If you know any good examples of query data to JS var after short-code, or a good short-code detection function perhaps. I’ve yet to get mine to work well.

    Update you once I make some progress again. Thanks!

Viewing 1 replies (of 1 total)

The topic ‘Unnecessary SQL query execution on homepage – optimization request’ is closed to new replies.