badgerherald / badgerherald.com

The Badger Herald's college media platform for WordPress.
http://badgerherald.com
Other
5 stars 1 forks source link

slow queries #249

Closed wjhdev closed 2 years ago

wjhdev commented 2 years ago

Finding several queries that are slowing down time to first bit on the homepage:

   [47] => Array
        (
            [0] => SELECT   wp_posts.ID FROM wp_posts  LEFT JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) LEFT JOIN wp_posts AS p2 ON (wp_posts.post_parent = p2.ID)  WHERE 1=1  AND ( 
  wp_term_relationships.term_taxonomy_id IN (168,421)
) AND wp_posts.post_type = 'post' AND (((wp_posts.post_status = 'publish') OR (wp_posts.post_status = 'inherit' AND (p2.post_status = 'publish')))) GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 10
            [1] => 0.17660593986511
            [2] => require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/badgerherald.com/index.php'), exa_container, Container->__construct, Container->executeTemplate, get_template_part, locate_template, load_template, require('/themes/badgerherald.com/containers/ad-and-two-dominant.php'), WP_Query->__construct, WP_Query->query, WP_Query->get_posts
            [3] => 1645975398.7113
            [4] => Array
                (
                )

        )

    [29] => Array
        (
            [0] => SELECT   wp_posts.ID FROM wp_posts  LEFT JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) LEFT JOIN wp_posts AS p2 ON (wp_posts.post_parent = p2.ID)  WHERE 1=1  AND ( 
  wp_term_relationships.term_taxonomy_id IN (168)
) AND wp_posts.post_type = 'post' AND (((wp_posts.post_status = 'publish') OR (wp_posts.post_status = 'inherit' AND (p2.post_status = 'publish')))) GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 10
            [1] => 0.12513184547424
            [2] => require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/badgerherald.com/index.php'), exa_container, Container->__construct, Container->executeTemplate, get_template_part, locate_template, load_template, require('/themes/badgerherald.com/containers/feature-widget.php'), WP_Query->__construct, WP_Query->query, WP_Query->get_posts
            [3] => 1645975398.4653
            [4] => Array
                (
                )

        )

   [4] => Array
        (
            [0] => SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  WHERE 1=1  AND ((wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' 
OR wp_posts.post_status = 'private')))  ORDER BY wp_posts.post_date DESC LIMIT 0, 10
            [1] => 0.072304010391235
            [2] => require('wp-blog-header.php'), wp, WP->main, WP->query_posts, WP_Query->query, WP_Query->get_posts
            [3] => 1645975398.256
            [4] => Array
                (
                )

        )

    [59] => Array
        (
            [0] => SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  LEFT JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) LEFT JOIN wp_posts AS p2 ON (wp_posts.post_parent = p2.ID)  WHERE 1=1  AND ( 
  wp_term_relationships.term_taxonomy_id IN (168,421)
) AND wp_posts.post_type = 'post' AND (((wp_posts.post_status = 'publish') OR (wp_posts.post_status = 'inherit' AND (p2.post_status = 'publish')))) GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 10
            [1] => 0.11143803596497
            [2] => require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/badgerherald.com/index.php'), exa_container, Container->__construct, Container->executeTemplate, get_template_part, locate_template, load_template, require('/themes/badgerherald.com/containers/list-and-banter.php'), WP_Query->__construct, WP_Query->query, WP_Query->get_posts
            [3] => 1645975398.9387
            [4] => Array
                (
                )

        )

   [129] => Array
        (
            [0] => SELECT   wp_posts.ID FROM wp_posts  LEFT JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id)  LEFT JOIN wp_term_relationships AS tt1 ON (wp_posts.ID = tt1.object_id) WHERE 1=1  AND ( 
  wp_term_relationships.term_taxonomy_id IN (369) 
  AND 
  tt1.term_taxonomy_id IN (168,421)
) AND ((wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' 
OR wp_posts.post_status = 'private'))) GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 3
            [1] => 0.065814018249512
            [2] => require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/badgerherald.com/index.php'), exa_container, Container->__construct, Container->executeTemplate, get_template_part, locate_template, load_template, require('/themes/badgerherald.com/containers/old-homepage.php'), WP_Query->__construct, WP_Query->query, WP_Query->get_posts
            [3] => 1645975399.2573
            [4] => Array
                (
                )

        )

   [357] => Array
        (
            [0] => 
        SELECT comment_approved, COUNT( * ) AS total
        FROM wp_comments

        GROUP BY comment_approved

            [1] => 0.061794996261597
            [2] => require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/badgerherald.com/index.php'), get_footer, locate_template, load_template, require_once('/themes/badgerherald.com/footer.php'), wp_footer, do_action('wp_footer'), WP_Hook->do_action, WP_Hook->apply_filters, wp_admin_bar_render, do_action_ref_array('admin_bar_menu'), WP_Hook->do_action, WP_Hook->apply_filters, wp_admin_bar_comments_menu, wp_count_comments, get_comment_count
            [3] => 1645975403.2369
            [4] => Array
                (
                )

        )
wjhdev commented 2 years ago

This really isn't a problem with redis in place—and I found the actual rogue query that was slowing down wp-admin so closing this as not a priority.