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

WordPress Trac noreply at wordpress.org
Mon Jun 26 13:45:03 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 boonebgorges):

 > 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.

 Yes, but as [comment:3 I mentioned above], the real-life savings here are
 very modest. Updates to comment/term meta will often, if not usually, be
 accompanied by a comment/term update, which will result in the same
 invalidation.

 Moreover: If we introduced `comment_meta` and `term_meta` incrementors,
 they would have to be invalidated every time the `comment` or `term`
 incrementors were busted; queries using 'meta_query' will be affected by
 general term/comment updates. And this is something that can't easily be
 done automatically in `update_meta()` etc, because of the way we have
 named our cache groups. This is part of the [comment:3 "maintenance
 overhead"] I talked about earlier: we have to remember to bump multiple
 incrementors to avoid corner-case invalidation bugs. The benefit for this
 is very modest, so I think it's not worth it.

 So I'd advocate instead for taking the strategy from `*_term_meta()` and
 applying it to comment meta as well.

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


More information about the wp-trac mailing list