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

WordPress Trac noreply at wordpress.org
Mon Sep 24 11:46:02 UTC 2018


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

Comment (by sjthompson):

 Also seeing the same issue here through Yoast SEO's use of the function.
 Forgive my ignorance here, but is there any reason the query in
 attachment_url_to_postid can't be modified with a "LIMIT 1"?

 Patching this on our local environment takes a 0.6s query down to 0.11 -
 not necessarily solving the whole problem, but helping at least.

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


More information about the wp-trac mailing list