[wp-trac] [WordPress Trac] #19664: wp_dashboard_recent_comments() has very bad performance with lots of spam

WordPress Trac wp-trac at lists.automattic.com
Sat Dec 24 16:03:14 UTC 2011


#19664: wp_dashboard_recent_comments() has very bad performance with lots of spam
--------------------------+-----------------------------
 Reporter:  joehoyle      |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Comments      |    Version:  3.3
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 The way `wp_dashboard_recent_comments()` loops the comments is very
 inefficient. This is because it gets comments 50 at a time, fills the
 recent commnts array, and fetches another 50 if the array was not filled
 (due to comments being spam etc), fetches another 50.. and so on.

 I recently had an issue with a site that had 5000 spam comments _in front_
 of any approved comments, this took about 20+ seconds to load the
 dashboard. The fix it seems is simple: specify the approves status in the
 mysql query instead - not sure why this was never done.

 I have attached a patch for this.

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


More information about the wp-trac mailing list