[wp-trac] [WordPress Trac] #41281: attachment_url_to_postid results in very slow query

WordPress Trac noreply at wordpress.org
Fri Jun 14 09:22:58 UTC 2019


#41281: attachment_url_to_postid results in very slow query
------------------------------+------------------------------
 Reporter:  Takahashi_Fumiki  |       Owner:  joemcgill
     Type:  enhancement       |      Status:  accepted
 Priority:  normal            |   Milestone:  Awaiting Review
Component:  Database          |     Version:  4.9
 Severity:  normal            |  Resolution:
 Keywords:                    |     Focuses:  performance
------------------------------+------------------------------
Changes (by joemcgill):

 * owner:  (none) => joemcgill
 * status:  new => accepted


Comment:

 Seems to me that adding at least minimal caching of these lookups would be
 valuable and potentially adding a filter before the query is run to allow
 for more easily handling specialized cases, like bailing early if you know
 that the URL won't resolve to a post ID.

 Before adding a simple cache wrapper around the query results, I'd like to
 better understand the use cases where the current situation is a problem.
 For example, where would a simple cache keyed to the input `$url` value be
 inadequate?

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


More information about the wp-trac mailing list