[wp-trac] [WordPress Trac] #5820: Reduce queries by wp_count_posts()

WordPress Trac wp-trac at lists.automattic.com
Mon Feb 11 22:00:59 GMT 2008


#5820: Reduce queries by wp_count_posts()
-------------------------+--------------------------------------------------
 Reporter:  josephscott  |       Owner:  anonymous
     Type:  enhancement  |      Status:  new      
 Priority:  normal       |   Milestone:  2.5      
Component:  General      |     Version:  2.5      
 Severity:  normal       |    Keywords:  has-patch
-------------------------+--------------------------------------------------
 The new function wp_count_posts() needs to do a query for each combination
 of post_type and post_status.  By doing a 'GROUP BY post_status' for each
 post_type request we can provide more data with one query.

 Here are patches that make this change and update the dashboard to make
 use of this new feature.

 One other thing I came across in the dashboard is a query for the number
 of approved comments.  The dashboard patch removes this query because that
 data isn't used anymore.  If it does need to come back it should use the
 get_comment_count() function instead.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/5820>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list