[wp-trac] [WordPress Trac] #40669: Proper query cache invalidation on queries meta queries

WordPress Trac noreply at wordpress.org
Sun Jun 25 20:47:35 UTC 2017


#40669: Proper query cache invalidation on queries meta queries
-------------------------------------------------+-------------------------
 Reporter:  spacedmonkey                         |       Owner:
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  4.9
Component:  Query                                |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch dev-feedback needs-unit-   |     Focuses:
  tests                                          |  performance
-------------------------------------------------+-------------------------

Comment (by spacedmonkey):

 In [https://core.trac.wordpress.org/attachment/ticket/40669/40669.2.diff
 40669.2.diff] I have a test that proves that add_comment_meta doesn't
 invalid caches correctly.

 Admittedly term meta / term query doesn't have this issue as the last
 changed for term is changed whenever any term meta function is used.

 This change is not only a bug fix but a performance change. Currently when
 you add any term meta, it invalidate all term queries. This is fine, but
 extreme. If a value of say comment meta is changed, this only effects
 queries with a meta query,  as this joins to the meta table. Most queries
 in core and plugins do not have meta queries and are invalidated
 unnecessarily.

 In #40229 and #38025 we have discussed adding meta queries to the network
 / site query classes. Both of these classes are used in the bootstrap
 process, so it is important that caching works well for these classes. It
 is likely the network options and blog meta might be updated a lot, it
 would effect performance if the queries were always being invalidated.

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


More information about the wp-trac mailing list