[wp-trac] [WordPress Trac] #30044: Use subqueries for AND clauses in WP_Meta_Query

WordPress Trac noreply at wordpress.org
Sun Oct 19 19:04:09 UTC 2014


#30044: Use subqueries for AND clauses in WP_Meta_Query
--------------------------+----------------------------
 Reporter:  boonebgorges  |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Future Release
Component:  Query         |    Version:
 Severity:  normal        |   Keywords:
  Focuses:  performance   |
--------------------------+----------------------------
 See #24093, starting about here, for background:
 https://core.trac.wordpress.org/ticket/24093#comment:10

 When multiple clauses are passed to `WP_Meta_Query` under the scope of an
 AND relation, a new table JOIN is required for each clause. With very
 large meta tables, this can lead to poor performance. We should
 investigate the performance implications of using subqueries for some of
 these queries to avoid the joins, much like what happens in `WP_Tax_Query`
 for NOT IN and AND operators.

 Note that the improvements to OR queries in [29953] probably mean that
 subqueries will not be faster in most cases where relation=OR.

 First step toward this would be to see some benchmarks using data of
 different kinds: small databases; large sets of posts with relatively
 small postmeta tables; large sets of posts with large amounts of postmeta.
 As pento notes here
 https://core.trac.wordpress.org/ticket/24093#comment:30, we'll also need
 to look at how performance differs between supported versions of MySQL.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/30044>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list