[wp-trac] [WordPress Trac] #39358: Media search speed has been dramatically reduced

WordPress Trac noreply at wordpress.org
Wed Dec 21 08:15:37 UTC 2016


#39358: Media search speed has been dramatically reduced
--------------------------+------------------------------
 Reporter:  merts         |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Media         |     Version:  4.7
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------
Description changed by dd32:

Old description:

> In the ajax-actions.php file there is function called
> wp_ajax_query_attachments. This function is responsible for searching
> images in the media library.
>
> We see that in Wordpress 4.7, someone added a new filter to this
> function:
>
>         // Filter query clauses to include filenames.
>         if ( isset( $query['s'] ) ) {
>                 add_filter( 'posts_clauses',
> '_filter_query_attachment_filenames' );
>         }
>
> This filter is a performance killer and takes forever to output a result
> in large databases. We have tested this with db that has over 500000
> posts.

New description:

 In the ajax-actions.php file there is function called
 wp_ajax_query_attachments. This function is responsible for searching
 images in the media library.

 We see that in Wordpress 4.7, someone added a new filter to this function:
 {{{
         // Filter query clauses to include filenames.
         if ( isset( $query['s'] ) ) {
                 add_filter( 'posts_clauses',
 '_filter_query_attachment_filenames' );
         }
 }}}
 This filter is a performance killer and takes forever to output a result
 in large databases. We have tested this with db that has over 500000
 posts.

--

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


More information about the wp-trac mailing list