[wp-trac] [WordPress Trac] #57373: WP_Query loading posts twice.

WordPress Trac noreply at wordpress.org
Thu Jan 19 04:18:37 UTC 2023


#57373: WP_Query loading posts twice.
--------------------------+---------------------------
 Reporter:  spacedmonkey  |       Owner:  spacedmonkey
     Type:  defect (bug)  |      Status:  reopened
 Priority:  normal        |   Milestone:  6.1.2
Component:  Query         |     Version:  6.1
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:  performance
--------------------------+---------------------------

Comment (by peterwilsoncc):

 Hi @davidbinda

 When updating the post meta cache, ultimately `update_meta_cache()` is
 called which includes a check for non-cached IDs about half way through
 the function ([https://github.com/WordPress/wordpress-
 develop/blob/77b3243518b1e94062f9dc7f4129f299004e6376/src/wp-
 includes/meta.php#L1156-L1166 see source code]).

 For term caches, `update_object_term_cache()` is used and includes a
 similar check, [https://github.com/WordPress/wordpress-
 develop/blob/ac9573bd67a225e51fb7b698b4d507e6ae396f83/src/wp-
 includes/taxonomy.php#L3731-L3743 see the source code].

 However, you are right, in that the post object caches (ie, the post
 table) are written regardless of whether they are warm or not. Could that
 be the single cause of the increased memory footprint you are seeing?

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


More information about the wp-trac mailing list