Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#44580 closed enhancement (duplicate)

The function attachment_url_to_postid in wp-includes/media.php causes a slow query for a huge database

Reported by: samvthom16 Owned by:
Priority: normal Milestone:
Component: Media Version: 4.9.7
Severity: normal Keywords:
Cc: Focuses: performance

Description

We have close to 40k posts and equivalent number of items in the media library. Lot of plugins like Yoast Seo use the function attachment_url_to_postid() quite often. This causes a slow query because of the huge database.

Solution:
Since URLs don't change that often. The function can use transient variables instead of querying the posts table.

Change History (1)

#1 @birgire
8 years ago

  • Milestone Awaiting Review
  • Resolutionduplicate
  • Status newclosed

Thanks for your report @samvthom16

This has already been reported in #41281.

Please join in there, thanks.

Note: See TracTickets for help on using tickets.