[wp-trac] [WordPress Trac] #57801: Implement lazy loading comment meta in WP_Comment_Query

WordPress Trac noreply at wordpress.org
Thu May 11 12:26:07 UTC 2023


#57801: Implement lazy loading comment meta in WP_Comment_Query
------------------------------+---------------------------
 Reporter:  spacedmonkey      |       Owner:  spacedmonkey
     Type:  enhancement       |      Status:  closed
 Priority:  normal            |   Milestone:  6.3
Component:  Comments          |     Version:  4.5
 Severity:  normal            |  Resolution:  fixed
 Keywords:  has-patch commit  |     Focuses:  performance
------------------------------+---------------------------
Changes (by spacedmonkey):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"55749" 55749]:
 {{{
 #!CommitTicketReference repository="" revision="55749"
 Comments: Always lazily load comment meta.

 In [34270] introduced lazy loading of comment meta. However, this was only
 in the context of `WP_Query`. Other parts of the codebase, like
 `WP_Comment_Query` did not lazily load comment meta. In this change, calls
 to `update_meta_cache` are now replaced with `wp_lazyload_comment_meta`,
 that instead of priming comment meta caches, just adds them to the queue
 to be primed it ever called. This results in far less database queries, as
 there a number of places where comment meta is being primed unnecessarily
 and never used. Adding everything to the comment meta queue, also means
 that if comment meta is used, that is all loaded in a single database /
 cache call.

 Follow on from [55671], [55747].

 Props spacedmonkey, peterwilsoncc, flixos90, mukesh27.
 Fixes #57801.
 }}}

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


More information about the wp-trac mailing list