• davbel

    (@davbel)


    Hi

    I’ve been running Better Search with Woocommerce and Woocommerce Search by SKU. All was working well for the past 4 or 5 months, but then last week we started to get MySQL processes hanging / getting stuck and then bringing the site down with the WP can’t connect to DB message.

    After installing Query Monitor it seems that when a customer just hits return or types a v short query, this query runs;

    SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM db_posts INNER JOIN db_postmeta ON ( db_posts.ID = db_postmeta.post_id ) INNER JOIN db_postmeta AS mt1 ON ( db_posts.ID = mt1.post_id ) WHERE 1=1 AND db_posts.ID IN
    (every,post,in,in,the,database) LIMIT 0, 48;

    The “every,post,id,in,the,database” is literally every post ID from the DB which in this example creates a query approx 77k char long with 5156 post IDs.

    When I disable Better Search, and repeat the empty or short searches, the query doesn’t appear.

    • This topic was modified 8 years ago by davbel.
    • This topic was modified 8 years ago by davbel. Reason: changed DB variables to hide DB
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Causing Huge MySQL Queries’ is closed to new replies.