[wp-trac] [WordPress Trac] #31071: media / post_mime_type related queries are very slow on larger sites

WordPress Trac noreply at wordpress.org
Mon Mar 13 21:15:38 UTC 2017


#31071: media / post_mime_type related queries are very slow on larger sites
-------------------------------------------------+-------------------------
 Reporter:  archon810                            |       Owner:  pento
     Type:  defect (bug)                         |      Status:  assigned
 Priority:  normal                               |   Milestone:  Future
Component:  Media                                |  Release
 Severity:  normal                               |     Version:  4.1
 Keywords:  dev-feedback reporter-feedback 2nd-  |  Resolution:
  opinion has-patch                              |     Focuses:
                                                 |  performance
-------------------------------------------------+-------------------------

Comment (by adamsilverstein):

 Replying to [comment:52 jnylen0]:
 > [attachment:media.php.diff] from @sboisvert looks sound to me but needs
 some stylistic clean-up before commit.

 +1 i agree adding filters to enable bypassing these queries makes sense
 for now.  Lets get this patch cleaned up and the filters documented so
 developers can at least opt out of the queries.

 I looked into how these queries are used a bit further. The first two
 queries are used to set up
 wp.media.view.settings.attachmentCounts.video/audio that is used to in the
 'Add New Media' modal to determine whether the library contains
 video/audio - adding two additional links 'Create Media Playlist' and
 Create Video Playlist in the sidebar.

 Empty media library:

 [[Image(https://cl.ly/0c221u0m3U0X/Edit_Post__wpdev__WordPress_2017-03-13_16-51-59.jpg_363326_2017-03-13_16-57-58.jpg)]]

 W/audio:

 [[Image(https://cl.ly/2n1w3C1M280b/Edit_Post__wpdev__WordPress_2017-03-13_16-54-54.jpg)]]
 added a 'Create Audio Playlist' button.

 w/video:

 [[Image(https://cl.ly/293D250n3f0m/Edit_Post__wpdev__WordPress_2017-03-13_16-56-10.jpg
 )]]
 added a 'Create Video Playlist' button

 Bypassing these and always returning 1 doesn't really have much of an ill
 effect - its similar to going to add a gallery when you have no images in
 the library. Can we bypass these entirely once a site has a certain number
 of media items?

 Library with no audio, returning 1:

 [[Image(https://cl.ly/1U1V1v311X1i/Edit_Post__wpdev__WordPress_2017-03-13_17-08-23.jpg)]]

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


More information about the wp-trac mailing list