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

WordPress Trac noreply at wordpress.org
Thu Dec 22 17:54:36 UTC 2016


#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 GunGeekATX):

 Was looking at this myself today and wonder if this might be part of the
 solution:

 {{{
 $defaults = array(
         'post' => null,
         'has_media' => null,
         'has_video' => null,
 );
 $args = wp_parse_args( $args, $defaults );

 if ( null === $args['has_audio'] ) {
         // Run get_var() here.
 }
 }}}

 If we allow the developer to pass in a true/false value for those (or make
 the args filterable), the database queries could be skipped altogether.
 On the huge site I'm working on, those values are always going to be true,
 so there's no need to run the database query, indexed or not.

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


More information about the wp-trac mailing list