[wp-trac] [WordPress Trac] #24093: WP_Meta_Query is inefficient when referencing the same keys in "OR" query

WordPress Trac noreply at wordpress.org
Mon Apr 15 16:21:31 UTC 2013


#24093: WP_Meta_Query is inefficient when referencing the same keys in "OR" query
-------------------------------------------------+-------------------------
 Reporter:  sc0ttkclark                          |       Type:  enhancement
   Status:  new                                  |   Priority:  normal
Milestone:  Awaiting Review                      |  Component:  Query
  Version:                                       |   Severity:  normal
 Keywords:  has-patch needs-testing dev-         |
  feedback                                       |
-------------------------------------------------+-------------------------
 This is part of the chain of thought from #19729

 The corresponding fix for #19729 was done in [22103]

 I believe this fix didn't take things far enough. For example, a
 meta_query that does a lot of comparing on the same meta_key, will have a
 JOIN and a WHERE for each query array. It shouldn't have to re-join the
 postmeta table on each query array though, since they are based on the
 same meta_key.

 I'll attach a suggested patch that will only join if it needs to, and use
 the previous alias for the first meta_key joined table if it's already
 been joined.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/24093>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list