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

WordPress Trac noreply at wordpress.org
Wed Feb 14 05:33:20 UTC 2018


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

Comment (by Takahashi_Fumiki):

 @markjaquith thanks for a comment and tip.

 In my case, I've tried to solve it with page cache at first.
 But "spike" of traffic overwhelmed it, because it was a historical big
 news.
 MySQL upset before creating cache.

 We finally solved it by adding index to `meta_value` as raw query. Forward
 match may work on other query.
 Of course, adding index isn't fundamental resolution in case I have
 300,000,000 posts or domain is longer than 64 letters.

 I guess this is very rare case and I don't know we should apply this patch
 to WP core.
 Besides that, it's very tough to add index to `wp_postmeta`. I forgot
 which ticket, but I guess you should know which ticket I mention:)

 Anyway, I believe this ticket is useful knowledge for a few people like
 "how to piss on top of Mt. Everest".

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


More information about the wp-trac mailing list