[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
Fri Jul 7 06:01:31 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.3
Component:  Comments      |     Version:  6.2.2
 Severity:  minor         |  Resolution:
 Keywords:  has-patch     |     Focuses:  performance
--------------------------+----------------------------

Comment (by Guss77):

 Replying to [comment:43 peterwilsoncc]:
 > Running some EXPLAINs on MySQL 8.0.30-ubuntu using the innoDB engine:
 >
 > For the count queries, the query optimizer is discarding the orderby
 clause provided by WP and defaulting to it's preference:

 Thank you for doing the detailed analysis on this issue.

 Unfortunately, I'm not using MySQL 8, and - as I reported in the original
 ticket description - for the first query that you tested, the database I
 use does not discard the unneeded `ORDER BY` and that massively slows it
 down.

 As far as I can tell, the `ORDER BY` clause is always wrong when there is
 a `COUNT`, and even if some database implementations are smart enough to
 ignore it - it should still be removed.

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


More information about the wp-trac mailing list