[wp-trac] [WordPress Trac] #29062: WP_Meta_Query with NOT EXISTS fails during multiple conditions

WordPress Trac noreply at wordpress.org
Tue Oct 14 02:13:38 UTC 2014


#29062: WP_Meta_Query with NOT EXISTS fails during multiple conditions
--------------------------+---------------------------
 Reporter:  johnrom       |       Owner:  boonebgorges
     Type:  defect (bug)  |      Status:  reviewing
 Priority:  normal        |   Milestone:  4.1
Component:  Query         |     Version:  3.9.1
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+---------------------------
Changes (by boonebgorges):

 * keywords:  needs-patch needs-unit-tests =>
 * milestone:  Future Release => 4.1


Comment:

 > When a specific post has no post meta at all associated with it, it is
 excluded completely from the INNER JOIN that results from these
 conditions.

 Confirmed. Note that this *only* happens when a given post has no metadata
 - you can see in [attachment:29062.test.patch] that I needed to delete all
 the metadata for a post in order reproduce the issue.

 `LEFT JOIN` performs more poorly at scale than `INNER JOIN`, but we're
 talking about a relative edge case: the only time when we need to change
 the JOIN is when the meta query has more than one clause, and when one of
 the clauses has `compare=NOT EXISTS`. And I think we all know deep down
 that `WP_Meta_Query` doesn't perform all that great at scale in general ;)
 So let's fix the bug.

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


More information about the wp-trac mailing list