[wp-trac] [WordPress Trac] #15396: Queries not being cached

WordPress Trac wp-trac at lists.automattic.com
Thu Nov 18 22:46:39 UTC 2010


#15396: Queries not being cached
--------------------------+-------------------------------------------------
 Reporter:  sivel         |       Owner:     
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  3.1
Component:  Cache         |     Version:  3.1
 Severity:  normal        |    Keywords:     
--------------------------+-------------------------------------------------

Comment(by sivel):

 Something has changed for the worst since this bug was reported.

 Here are the queries running with an object cache at r16318:

 {{{
 Array
 (
     [0] => Array
         (
             [0] =>  SELECT SQL_CALC_FOUND_ROWS  wp_posts.* FROM wp_posts
 WHERE 1=1  AND wp_posts.post_type = 'post' AND (wp_posts.post_status =
 'publish')  ORDER BY wp_posts.post_date DESC LIMIT 0, 10
             [1] => 0.00077295303344727
             [2] => require, wp, WP->main, WP->query_posts,
 WP_Query->query, WP_Query->get_posts
         )

     [1] => Array
         (
             [0] => SELECT FOUND_ROWS()
             [1] => 0.00038599967956543
             [2] => require, wp, WP->main, WP->query_posts,
 WP_Query->query, WP_Query->get_posts
         )

     [2] => Array
         (
             [0] => SELECT t.name FROM wp_terms AS t INNER JOIN
 wp_term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN
 wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id
 WHERE tt.taxonomy IN ('post_format') AND tr.object_id IN (1)
             [1] => 0.00032305717468262
             [2] => require, require_once, include, get_template_part,
 locate_template, load_template, require, get_post_format,
 wp_get_object_terms
         )

     [3] => Array
         (
             [0] => SELECT t.name FROM wp_terms AS t INNER JOIN
 wp_term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN
 wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id
 WHERE tt.taxonomy IN ('post_format') AND tr.object_id IN (1)
             [1] => 0.00015401840209961
             [2] => require, require_once, include, get_template_part,
 locate_template, load_template, require, get_post_format,
 wp_get_object_terms
         )

     [4] => Array
         (
             [0] => SELECT t.name FROM wp_terms AS t INNER JOIN
 wp_term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN
 wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id
 WHERE tt.taxonomy IN ('post_format') AND tr.object_id IN (1)
             [1] => 0.00014209747314453
             [2] => require, require_once, include, get_template_part,
 locate_template, load_template, require, post_class, get_post_class,
 get_post_format, wp_get_object_terms
         )

     [5] => Array
         (
             [0] => SELECT t.*, tt.* FROM wp_terms AS t INNER JOIN
 wp_term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN
 wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id
 WHERE tt.taxonomy IN ('post_tag') AND tr.object_id IN (1) ORDER BY t.name
 ASC
             [1] => 0.0010671615600586
             [2] => require, require_once, include, get_template_part,
 locate_template, load_template, require, post_class, get_post_class,
 get_the_tags, get_the_terms, wp_get_object_terms
         )

     [6] => Array
         (
             [0] => SELECT t.*, tt.* FROM wp_terms AS t INNER JOIN
 wp_term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN
 wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id
 WHERE tt.taxonomy IN ('post_tag') AND tr.object_id IN (1) ORDER BY t.name
 ASC
             [1] => 0.001255989074707
             [2] => require, require_once, include, get_template_part,
 locate_template, load_template, require, get_the_tag_list,
 get_the_term_list, get_the_terms, wp_get_object_terms
         )

 )
 }}}

 Here are the queries that are running with an object cache at r16472:

 {{{
 Array
 (
     [0] => Array
         (
             [0] =>  SELECT SQL_CALC_FOUND_ROWS  wp_posts.* FROM wp_posts
 WHERE 1=1  AND wp_posts.post_type = 'post' AND (wp_posts.post_status =
 'publish')  ORDER BY wp_posts.post_date DESC LIMIT 0, 10
             [1] => 0.000823974609375
             [2] => require, wp, WP->main, WP->query_posts,
 WP_Query->query, WP_Query->get_posts
         )

     [1] => Array
         (
             [0] => SELECT FOUND_ROWS()
             [1] => 0.00020313262939453
             [2] => require, wp, WP->main, WP->query_posts,
 WP_Query->query, WP_Query->get_posts
         )

     [2] => Array
         (
             [0] => SELECT t.*, tt.* FROM wp_terms AS t INNER JOIN
 wp_term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN
 wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id
 WHERE tt.taxonomy IN ('category') AND tr.object_id IN (1) ORDER BY t.name
 ASC
             [1] => 0.0025889873504639
             [2] => require, require_once, include, get_template_part,
 locate_template, load_template, require, in_category, has_term,
 is_object_in_term, wp_get_object_terms
         )

     [3] => Array
         (
             [0] => SELECT t.*, tt.* FROM wp_terms AS t INNER JOIN
 wp_term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN
 wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id
 WHERE tt.taxonomy IN ('post_format') AND tr.object_id IN (1) ORDER BY
 t.name ASC
             [1] => 0.00097179412841797
             [2] => require, require_once, include, get_template_part,
 locate_template, load_template, require, get_post_format, get_the_terms,
 wp_get_object_terms
         )

     [4] => Array
         (
             [0] => SELECT t.*, tt.* FROM wp_terms AS t INNER JOIN
 wp_term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN
 wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id
 WHERE tt.taxonomy IN ('category') AND tr.object_id IN (1) ORDER BY t.name
 ASC
             [1] => 0.001133918762207
             [2] => require, require_once, include, get_template_part,
 locate_template, load_template, require, in_category, has_term,
 is_object_in_term, wp_get_object_terms
         )

     [5] => Array
         (
             [0] => SELECT t.*, tt.* FROM wp_terms AS t INNER JOIN
 wp_term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN
 wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id
 WHERE tt.taxonomy IN ('post_format') AND tr.object_id IN (1) ORDER BY
 t.name ASC
             [1] => 0.0010449886322021
             [2] => require, require_once, include, get_template_part,
 locate_template, load_template, require, get_post_format, get_the_terms,
 wp_get_object_terms
         )

     [6] => Array
         (
             [0] => SELECT t.*, tt.* FROM wp_terms AS t INNER JOIN
 wp_term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN
 wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id
 WHERE tt.taxonomy IN ('post_format') AND tr.object_id IN (1) ORDER BY
 t.name ASC
             [1] => 0.0010449886322021
             [2] => require, require_once, include, get_template_part,
 locate_template, load_template, require, post_class, get_post_class,
 get_post_format, get_the_terms, wp_get_object_terms
         )

     [7] => Array
         (
             [0] => SELECT t.*, tt.* FROM wp_terms AS t INNER JOIN
 wp_term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN
 wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id
 WHERE tt.taxonomy IN ('category') AND tr.object_id IN (1) ORDER BY t.name
 ASC
             [1] => 0.0012438297271729
             [2] => require, require_once, include, get_template_part,
 locate_template, load_template, require, post_class, get_post_class,
 get_the_category, get_the_terms, wp_get_object_terms
         )

     [8] => Array
         (
             [0] => SELECT t.*, tt.* FROM wp_terms AS t INNER JOIN
 wp_term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN
 wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id
 WHERE tt.taxonomy IN ('post_tag') AND tr.object_id IN (1) ORDER BY t.name
 ASC
             [1] => 0.0013110637664795
             [2] => require, require_once, include, get_template_part,
 locate_template, load_template, require, post_class, get_post_class,
 get_the_tags, get_the_terms, wp_get_object_terms
         )

     [9] => Array
         (
             [0] => SELECT t.*, tt.* FROM wp_terms AS t INNER JOIN
 wp_term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN
 wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id
 WHERE tt.taxonomy IN ('category') AND tr.object_id IN (1) ORDER BY t.name
 ASC
             [1] => 0.0018959045410156
             [2] => require, require_once, include, get_template_part,
 locate_template, load_template, require, get_the_category, get_the_terms,
 wp_get_object_terms
         )

     [10] => Array
         (
             [0] => SELECT t.*, tt.* FROM wp_terms AS t INNER JOIN
 wp_term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN
 wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id
 WHERE tt.taxonomy IN ('category') AND tr.object_id IN (1) ORDER BY t.name
 ASC
             [1] => 0.0011169910430908
             [2] => require, require_once, include, get_template_part,
 locate_template, load_template, require, get_the_category_list,
 get_the_category, get_the_terms, wp_get_object_terms
         )

     [11] => Array
         (
             [0] => SELECT t.*, tt.* FROM wp_terms AS t INNER JOIN
 wp_term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN
 wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id
 WHERE tt.taxonomy IN ('post_tag') AND tr.object_id IN (1) ORDER BY t.name
 ASC
             [1] => 0.0011022090911865
             [2] => require, require_once, include, get_template_part,
 locate_template, load_template, require, get_the_tag_list,
 get_the_term_list, get_the_terms, wp_get_object_terms
         )

 )
 }}}

 As you can see, previously we still had 7 queries running, now we are up
 to 12.  At r16319, r16320, r16321, r16322, r16323 we were still at 7
 queries, so I am not sure any of the commits that went in really helped.
 However, it looks like the additional queries that aren't being cached
 were added in [16332].

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/15396#comment:6>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list