Make WordPress Core

Opened 18 months ago

Last modified 4 months ago

#59488 new enhancement

Add index to comment_type and comment_approved fields in comment table

Reported by: spacedmonkey's profile spacedmonkey Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 3.0
Component: Comments Keywords:
Focuses: performance Cc:

Description

Follow on from #58368

It is common to query comments by comment_type or comment_approved. There are several query done in the admin to get counts for different screens. But for sites with many comments, this results in slow returning queries. Add database indexes to these two fields to improve database performance.

Change History (2)

#1 @spacedmonkey
4 months ago

The gutenberg team is exploring inline comments. See ticket.

This ticket adds a new a custom comment type. This means that the new endpoints / code will query by comment type. As the comment table might get much large ( because of many inline comment ) these query will likely get much slower.

Adding an index here is simple, an a index for comment type, makes sense, as other table, like post index their type ( post type ).

Pinging members of the performance in hopes this change makes it into WP 6.8.

CC @flixos90 @swissspidy @joemcgill @mukesh27

#2 @swissspidy
4 months ago

Probably makes sense, but of course needs some numbers to prove that.

As the comment table might get much large ( because of many inline comment )

FWIW I doubt that. These comments are only temporary AFAIK.

Note: See TracTickets for help on using tickets.