[wp-trac] [WordPress Trac] #15499: Add an index for get_lastpostmodified query

WordPress Trac noreply at wordpress.org
Sun Feb 15 14:54:00 UTC 2015


#15499: Add an index for get_lastpostmodified query
-------------------------------------------------+-------------------------
 Reporter:  simonwheatley                        |       Owner:
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  Future
Component:  Database                             |  Release
 Severity:  normal                               |     Version:  3.0.1
 Keywords:  has-patch dev-feedback 4.1-early     |  Resolution:
  commit                                         |     Focuses:
                                                 |  performance
-------------------------------------------------+-------------------------

Comment (by mdgl):

 Replying to [comment:22 Denis-de-Bernardy]:
 > In essence, rather than serving '''the''' absolute last modified, we
 could fetch the posts or comments that appear in a feed, and then simply
 loop through the array to find ''their'' last modified date (which would
 then indeed concern that specific feed, and that only, solving this ticket
 and #4575 in one go).

 I agree it would be much better if we used the last modified date of the
 data we have actually queried, rather than the last modified date of all
 posts/comments in the database. As far as I can see, the current code will
 presently return the wrong value for most category, tag and custom post
 type feeds (see also #22742).

 Having queried the data, a simple loop around the post objects in memory
 will almost certainly be much faster than querying the database for a
 second time, regardless of which columns are indexed.

 This seems do-able for the calls to `get_lastpostmodified()` and
 `get_lastcommentmodified()` in the various feed templates. Unfortunately,
 these functions are also used to generate the HTTP headers `Last-Modified`
 and `ETag` for feeds and which are output before we have even run the main
 query.

 What do you think? Is there a safe and efficient way of generating those
 HTTP header values?

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


More information about the wp-trac mailing list