[wp-trac] [WordPress Trac] #54346: Slow SQL queries fetching posts from specific categories

WordPress Trac noreply at wordpress.org
Mon Nov 22 19:43:18 UTC 2021


#54346: Slow SQL queries fetching posts from specific categories
-------------------------+------------------------------------
 Reporter:  Krstarica    |       Owner:  (none)
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Taxonomy     |     Version:  5.8.1
 Severity:  normal       |  Resolution:
 Keywords:               |     Focuses:  rest-api, performance
-------------------------+------------------------------------

Comment (by Krstarica):

 Running this for several days in production and speed improvement is
 impressive.

 Definitely should use subqueries in get_sql_for_clause functions (class-
 wp-meta-query.php and class-wp-tax-query.php) and then completely remove
 this code from class-wp-query.php:

 {{{
 if ( ! empty( $this->tax_query->queries ) || ! empty(
 $this->meta_query->queries ) ) {
         $groupby = "{$wpdb->posts}.ID";
 }
 }}}

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


More information about the wp-trac mailing list