• Resolved tonyhawa

    (@tonyhawa)


    Hi, I have an issue with the filter plugin, It is working very slow, specially on https://myfitbubble.com/product-category/clothing/ so we had to install the query monitor plugin to see what was the problem, we found out that this query is working very slow:

    SELECT qzh_posts.ID
    FROM qzh_posts
    LEFT JOIN qzh_term_relationships
    ON (qzh_posts.ID = qzh_term_relationships.object_id)
    LEFT JOIN qzh_term_relationships AS tt1
    ON (qzh_posts.ID = tt1.object_id)
    LEFT JOIN qzh_term_relationships AS tt2
    ON (qzh_posts.ID = tt2.object_id)
    LEFT JOIN qzh_term_relationships AS tt3
    ON (qzh_posts.ID = tt3.object_id)
    LEFT JOIN qzh_term_relationships AS tt4
    ON (qzh_posts.ID = tt4.object_id)
    LEFT JOIN qzh_term_relationships AS tt5
    ON (qzh_posts.ID = tt5.object_id)
    LEFT JOIN qzh_term_relationships AS tt6
    ON (qzh_posts.ID = tt6.object_id)

    WHERE 1=1
    AND ( qzh_posts.ID NOT IN (
    SELECT object_id
    FROM qzh_term_relationships
    WHERE term_taxonomy_id IN (7) )
    AND qzh_posts.ID NOT IN (
    SELECT object_id
    FROM qzh_term_relationships
    WHERE term_taxonomy_id IN (7) )
    AND ( qzh_term_relationships.term_taxonomy_id IN (22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,89,107,108) )
    AND qzh_posts.ID NOT IN (
    SELECT object_id
    FROM qzh_term_relationships
    WHERE term_taxonomy_id IN (7) )
    AND ( tt1.term_taxonomy_id IN (22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,89,107,108) )
    AND qzh_posts.ID NOT IN (
    SELECT object_id
    FROM qzh_term_relationships
    WHERE term_taxonomy_id IN (7) )
    AND ( tt2.term_taxonomy_id IN (22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,89,107,108) )
    AND qzh_posts.ID NOT IN (
    SELECT object_id
    FROM qzh_term_relationships
    WHERE term_taxonomy_id IN (7) )
    AND ( tt3.term_taxonomy_id IN (22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,89,107,108) )
    AND qzh_posts.ID NOT IN (
    SELECT object_id
    FROM qzh_term_relationships
    WHERE term_taxonomy_id IN (7) )
    AND ( tt4.term_taxonomy_id IN (22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,89,107,108) )
    AND qzh_posts.ID NOT IN (
    SELECT object_id
    FROM qzh_term_relationships
    WHERE term_taxonomy_id IN (7) )
    AND ( tt5.term_taxonomy_id IN (22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,89,107,108) )
    AND tt6.term_taxonomy_id IN (22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,89,107,108) )
    AND qzh_posts.post_type = \’product\’
    AND (qzh_posts.post_status = \’publish\’
    OR qzh_posts.post_status = \’cwg_mailsent\’
    OR qzh_posts.post_status = \’cwg_mailnotsent\’
    OR qzh_posts.post_status = \’cwg_subscribed\’
    OR qzh_posts.post_status = \’cwg_unsubscribed\’
    OR qzh_posts.post_status = \’cwg_converted\’
    OR qzh_posts.post_status = \’wc-return-requested\’
    OR qzh_posts.post_status = \’wc-return-approved\’
    OR qzh_posts.post_status = \’wc-return-cancelled\’
    OR qzh_posts.post_status = \’wc-exchange-request\’
    OR qzh_posts.post_status = \’wc-exchange-approve\’
    OR qzh_posts.post_status = \’wc-exchange-cancel\’
    OR qzh_posts.post_status = \’wc-partial-cancel\’
    OR qzh_posts.post_status = \’wc-dokan-refunded\’
    OR qzh_posts.post_status = \’private\’)
    GROUP BY qzh_posts.ID
    ORDER BY qzh_posts.menu_order ASC, qzh_posts.post_title ASC

    please note that our category model has up to 3 sub-categories (child)

    We\’ve created indexes qzh_posts.post_status_ind (type INDEX), qzh_term_relationships.object_id (type INDEX) but it didn\’t help.

    What can we do to make the query go faster?

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Querry running very slow’ is closed to new replies.