[wp-trac] [WordPress Trac] #18536: Improve performance of WP_Query core
WordPress Trac
wp-trac at lists.automattic.com
Mon Jan 30 16:30:44 UTC 2012
#18536: Improve performance of WP_Query core
--------------------------------------------------+------------------
Reporter: cheald | Owner:
Type: task (blessed) | Status: new
Priority: normal | Milestone: 3.4
Component: Performance | Version:
Severity: normal | Resolution:
Keywords: early has-patch commit needs-testing |
--------------------------------------------------+------------------
Comment (by prettyboymp):
Replying to [comment:51 nacin]:
> I don't think _prime_post_caches() has a use case outside of WP_Query.
If you wish to prime post caches elsewhere, simply use WP_Query. (For
example, we do this for nav menus.)
Yes, but doing it this way still causes the first query to get the
posts.ID of the posts that were already in the posts_in clause.
Take for instance the update_post_thumbnail_cache() function. Since we
already have the post thumbnail ids, there is no reason to run the ID
query just to get the same IDs which will be fed into the primer. The
same goes in the nav menus. I also use a similar function a lot in my own
code any time I need to show a user sorted list of posts.
It would be hard to avoid this extra query to get the id's you already
told it unless you specifically tell WP_Query that you won't be using the
sorted result.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/18536#comment:52>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list