WordPress.org

Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #22742


Ignore:
Timestamp:
12/04/2012 09:36:32 PM (5 years ago)
Author:
SergeyBiryukov
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #22742 – Description

    initial v1  
    66
    77In my page->feed conversion, I was curious what the performance implications were. I figured with less files and functions (related to the theme layer) involved, it could only be better using a feed. Not so, it was worse at about 5x to run the same feed creating logic. I sat down with xdebug and query logging to figure out what was going on and found that there were a few extra queries being run on the feed side:
    8 
     8{{{
    99SELECT post_modified_gmt FROM wp_posts WHERE post_status = 'publish' AND post_type IN ('post', 'page', 'attachment', 'story') ORDER BY post_modified_gmt DESC LIMIT 1;
    1010SELECT post_date_gmt FROM wp_posts WHERE post_status = 'publish' AND post_type IN ('post', 'page', 'attachment', 'story') ORDER BY post_date_gmt DESC LIMIT 1;
    1111SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  WHERE 1=1  AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private')  ORDER BY wp_posts.post_date DESC LIMIT 0, 50;
    1212SELECT FOUND_ROWS();
    13 
     13}}}
    1414These are coming from a branch in /wp-includes/class-wp.php WP::send_headers(). It's doing very basic logic to determine via the query string if we expect this request to be a feed, then it uses either ''get_lastcommentmodified()'' or ''get_lastpostmodified()'' and uses the result of that to set and send some headers for last modified and etag, and evaluate request values for conditional get (304) responses.
    1515
     
    3232'''I've noticed a little discussion on this issue elsewhere:'''
    3333
    34 http://core.trac.wordpress.org/ticket/19466 - This person is attempting to apply the existing logic--page/comment last modified across every request which would be a massive mistake. Assuming that's why there has been no response.
     34#19466 - This person is attempting to apply the existing logic--page/comment last modified across every request which would be a massive mistake. Assuming that's why there has been no response.
    3535
    36 http://core.trac.wordpress.org/ticket/15499 - This person is suggesting an index to get the results quicker--that could be beneficial additionally, but perhaps my modifications could reduce the need for such an index.
     36#15499 - This person is suggesting an index to get the results quicker--that could be beneficial additionally, but perhaps my modifications could reduce the need for such an index.