[wp-trac] [WordPress Trac] #24093: WP_Meta_Query is inefficient when referencing the same keys in "OR" query
WordPress Trac
noreply at wordpress.org
Fri May 2 07:04:25 UTC 2014
#24093: WP_Meta_Query is inefficient when referencing the same keys in "OR" query
-------------------------------------------------+-------------------------
Reporter: sc0ttkclark | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 4.0
Component: Query | Version: 3.5.1
Severity: normal | Resolution:
Keywords: needs-refresh meta-query needs- | Focuses:
unit-tests has-patch | performance
-------------------------------------------------+-------------------------
Changes (by vprat):
* keywords: needs-refresh meta-query needs-unit-tests needs-patch =>
needs-refresh meta-query needs-unit-tests has-patch
Comment:
Hi,
I have managed to fix the orderby meta issue.
So to sum up what I did:
- Always alias the meta table in the query, starting at mt0. Before the
patch, the first occurence was not aliased and the following ones were
aliased starting at mt1
- In the WP_Query class, for ordering, we simply use the mt0 alias instead
of the main meta table name.
- The rest is pretty similar to what had been proposed by the original
patchers.
Let me know if there is any test case that fails and how to reproduce it,
I'll try to fix the issue. I would love that patch to make its way into WP
4.0.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/24093#comment:18>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list