Make WordPress Core

Opened 13 years ago

Closed 13 years ago

#19664 closed defect (bug) (duplicate)

wp_dashboard_recent_comments() has very bad performance with lots of spam

Reported by: joehoyle's profile joehoyle Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.3
Component: Comments Keywords:
Focuses: Cc:

Description

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.

Attachments (1)

recent-comments-fix.diff (1.7 KB) - added by joehoyle 13 years ago.

Download all attachments as: .zip

Change History (2)

#1 @SergeyBiryukov
13 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.