[wp-trac] [WordPress Trac] #52722: Long running query causing site down

WordPress Trac noreply at wordpress.org
Tue Mar 9 02:44:52 UTC 2021


#52722: Long running query causing site down
--------------------------+------------------------------
 Reporter:  naveenbos1    |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:
 Severity:  critical      |  Resolution:
 Keywords:  needs-patch   |     Focuses:
--------------------------+------------------------------
Description changed by peterwilsoncc:

Old description:

> We have a site that is running on WordPress 5.2.9 and it is continuously
> site went down at 3 AM central every day due to running a long query on
> WordPress
>
> We did not find this query on the theme or plugin, Indly help to identify
> the issue.
>
> Query | 42546 | Sending data | SELECT COUNT(*) FROM sw_wp_posts LEFT JOIN
> sw_wp_term_relationships ON (sw_wp_posts.ID =
> sw_wp_term_relationships.object_id) LEFT JOIN sw_wp_term_relationships AS
> tt1 ON (sw_wp_posts.ID = tt1.object_id) LEFT JOIN
> sw_wp_term_relationships AS tt2 ON (sw_wp_posts.ID = tt2.object_id) LEFT
> JOIN sw_wp_term_relationships AS tt3 ON (sw_wp_posts.ID = tt3.object_id)
> LEFT JOIN sw_wp_term_relationships AS tt4 ON (sw_wp_posts.ID =
> tt4.object_id) LEFT JOIN sw_wp_term_relationships AS tt5 ON
> (sw_wp_posts.ID = tt5.object_id) LEFT JOIN sw_wp_term_relationships AS
> tt6 ON (sw_wp_posts.ID = tt6.object_id) LEFT JOIN
> sw_wp_term_relationships AS tt7 ON (sw_wp_posts.ID = tt7.object_id) LEFT
> JOIN sw_wp_term_relationships AS tt8 ON (sw_wp_posts.ID = tt8.object_id)
> LEFT JOIN sw_wp_term_relationships AS tt9 ON (sw_wp_posts.ID =
> tt9.object_id) LEFT JOIN sw_wp_term_relationships AS tt10 ON
> (sw_wp_posts.ID = tt10.object_id) LEFT JOIN sw_wp_term_relationships AS
> tt11 ON (sw_wp_posts.ID = tt11.object_id) LEFT JOIN
> sw_wp_term_relationships AS tt12 ON (sw_wp_posts.ID = tt12.object_id)
> LEFT JOIN sw_wp_term_relationships AS tt13 ON (sw_wp_posts.ID =
> tt13.object_id) LEFT JOIN sw_wp_term_relationships AS tt14 ON
> (sw_wp_posts.ID = tt14.object_id) LEFT JOIN sw_wp_term_relationships AS
> tt15 ON (sw_wp_posts.ID = tt15.object_id) LEFT JOIN
> sw_wp_term_relationships AS tt16 ON (sw_wp_posts.ID = tt16.object_id)
> LEFT JOIN sw_wp_term_relationships AS tt17 ON (sw_wp_posts.ID =
> tt17.object_id) WHERE 1=1 AND (
>
> (
>
> sw_wp_term_relationships.term_taxonomy_id IN (8)
>
> AND
>
> tt1.term_taxonomy_id IN (28)
>
> AND
>
> tt2.term_taxonomy_id IN (59)
>
> )
>
> OR
>
> (
>
> tt3.term_taxonomy_id IN (8)
>
> AND
>
> tt4.term_taxonomy_id IN (28)
>
> AND
>
> tt5.term_taxonomy_id IN (20)
>
> )
>
> OR
>
> (
>
> tt6.term_taxonomy_id IN (6)
>
> AND
>
> tt7.term_taxonomy_id IN (28)
>
> AND
>
> tt8.term_taxonomy_id IN (59)
>
> )
>
> OR
>
> (
>
> tt9.term_taxonomy_id IN (6)
>
> AND
>
> tt10.term_taxonomy_id IN (28)
>
> AND
>
> tt11.term_taxonomy_id IN (20)
>
> )
>
> OR
>
> (
>
> tt12.term_taxonomy_id IN (7)
>
> AND
>
> tt13.term_taxonomy_id IN (28)
>
> AND
>
> tt14.term_taxonomy_id IN (59)
>
> )
>
> OR
>
> (
>
> tt15.term_taxonomy_id IN (7)
>
> AND
>
> tt16.term_taxonomy_id IN (28)
>
> AND
>
> tt17.term_taxonomy_id IN (20)
>
> )
>
> ) AND sw_wp_posts.post_type = 'gallery' AND (sw_wp_posts.post_status =
> 'publish' OR sw_wp_posts.post_status = 'acf-disabled' OR
> sw_wp_posts.post_status = 'future' OR sw_wp_posts.post_status = 'draft'
> OR sw_wp_posts.post_status = 'pending') |

New description:

 We have a site that is running on WordPress 5.2.9 and it is continuously
 site went down at 3 AM central every day due to running a long query on
 WordPress

 We did not find this query on the theme or plugin, Indly help to identify
 the issue.

 Query | 42546 | Sending data |

 {{{#!sql
 SELECT Count(*)
 FROM   sw_wp_posts
        LEFT JOIN sw_wp_term_relationships
               ON ( sw_wp_posts.id = sw_wp_term_relationships.object_id )
        LEFT JOIN sw_wp_term_relationships AS tt1
               ON ( sw_wp_posts.id = tt1.object_id )
        LEFT JOIN sw_wp_term_relationships AS tt2
               ON ( sw_wp_posts.id = tt2.object_id )
        LEFT JOIN sw_wp_term_relationships AS tt3
               ON ( sw_wp_posts.id = tt3.object_id )
        LEFT JOIN sw_wp_term_relationships AS tt4
               ON ( sw_wp_posts.id = tt4.object_id )
        LEFT JOIN sw_wp_term_relationships AS tt5
               ON ( sw_wp_posts.id = tt5.object_id )
        LEFT JOIN sw_wp_term_relationships AS tt6
               ON ( sw_wp_posts.id = tt6.object_id )
        LEFT JOIN sw_wp_term_relationships AS tt7
               ON ( sw_wp_posts.id = tt7.object_id )
        LEFT JOIN sw_wp_term_relationships AS tt8
               ON ( sw_wp_posts.id = tt8.object_id )
        LEFT JOIN sw_wp_term_relationships AS tt9
               ON ( sw_wp_posts.id = tt9.object_id )
        LEFT JOIN sw_wp_term_relationships AS tt10
               ON ( sw_wp_posts.id = tt10.object_id )
        LEFT JOIN sw_wp_term_relationships AS tt11
               ON ( sw_wp_posts.id = tt11.object_id )
        LEFT JOIN sw_wp_term_relationships AS tt12
               ON ( sw_wp_posts.id = tt12.object_id )
        LEFT JOIN sw_wp_term_relationships AS tt13
               ON ( sw_wp_posts.id = tt13.object_id )
        LEFT JOIN sw_wp_term_relationships AS tt14
               ON ( sw_wp_posts.id = tt14.object_id )
        LEFT JOIN sw_wp_term_relationships AS tt15
               ON ( sw_wp_posts.id = tt15.object_id )
        LEFT JOIN sw_wp_term_relationships AS tt16
               ON ( sw_wp_posts.id = tt16.object_id )
        LEFT JOIN sw_wp_term_relationships AS tt17
               ON ( sw_wp_posts.id = tt17.object_id )
 WHERE  1 = 1
        AND ( ( sw_wp_term_relationships.term_taxonomy_id IN ( 8 )
                AND tt1.term_taxonomy_id IN ( 28 )
                AND tt2.term_taxonomy_id IN ( 59 ) )
               OR ( tt3.term_taxonomy_id IN ( 8 )
                    AND tt4.term_taxonomy_id IN ( 28 )
                    AND tt5.term_taxonomy_id IN ( 20 ) )
               OR ( tt6.term_taxonomy_id IN ( 6 )
                    AND tt7.term_taxonomy_id IN ( 28 )
                    AND tt8.term_taxonomy_id IN ( 59 ) )
               OR ( tt9.term_taxonomy_id IN ( 6 )
                    AND tt10.term_taxonomy_id IN ( 28 )
                    AND tt11.term_taxonomy_id IN ( 20 ) )
               OR ( tt12.term_taxonomy_id IN ( 7 )
                    AND tt13.term_taxonomy_id IN ( 28 )
                    AND tt14.term_taxonomy_id IN ( 59 ) )
               OR ( tt15.term_taxonomy_id IN ( 7 )
                    AND tt16.term_taxonomy_id IN ( 28 )
                    AND tt17.term_taxonomy_id IN ( 20 ) ) )
        AND sw_wp_posts.post_type = 'gallery'
        AND ( sw_wp_posts.post_status = 'publish'
               OR sw_wp_posts.post_status = 'acf-disabled'
               OR sw_wp_posts.post_status = 'future'
               OR sw_wp_posts.post_status = 'draft'
               OR sw_wp_posts.post_status = 'pending' )
 }}}

 --

 Edited to format SQL query -- @peterwilsoncc

--

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/52722#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list