[wp-trac] [WordPress Trac] #58368: WordPress dashboard is very slow when there are many comments (and the database isn't great)

WordPress Trac noreply at wordpress.org
Mon Jul 10 11:48:38 UTC 2023


#58368: WordPress dashboard is very slow when there are many comments (and the
database isn't great)
--------------------------+----------------------------
 Reporter:  Guss77        |       Owner:  peterwilsoncc
     Type:  defect (bug)  |      Status:  assigned
 Priority:  normal        |   Milestone:  6.4
Component:  Comments      |     Version:  6.0
 Severity:  minor         |  Resolution:
 Keywords:  has-patch     |     Focuses:  performance
--------------------------+----------------------------
Changes (by spacedmonkey):

 * version:  6.2.2 => 6.0
 * milestone:  6.3 => 6.4


Comment:

 Okay, I spent a little more time researching this one.

 First of all, the currently PR [https://github.com/WordPress/wordpress-
 develop/pull/4553 #4553] does seem to help improve the query. Using query
 monitor, I am seeing these values with 50k comments.

 > SELECT COUNT(*) FROM wp_comments WHERE ( comment_approved = '1' ) ORDER
 BY wp_comments.comment_date_gmt DESC

 0.0580

 VS

 > SELECT COUNT(*) FROM wp_comments WHERE ( comment_approved = '1' )

 0.0521

 This doesn't exactly fix the problem.

 I tried some other stuff, I changed the query to this.

 > SELECT COUNT(wp_comments.comment_ID) FROM wp_comments WHERE (
 comment_approved = '1' )

 0.0562

 Which did make things better either.
 I also created a index for `comment_approved`. Which also did nothing.

 I believe that [53036], did make this issue worse, as before it did one
 query with a group, now it does multiple queries.

 So I am unclear here what to do make this faster. As there is no clear
 path forward to fix this issue, I am going to punt this to WP 6.4, where
 we can find a solution.

 @peterwilsoncc If you want, you can commit the existing PR, but I think we
 should leave this ticket as is to do more research.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58368#comment:46>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list