[wp-trac] [WordPress Trac] #38173: Meta query creates unecessary multiple left joins when using the same meta key
WordPress Trac
noreply at wordpress.org
Mon Feb 13 11:04:16 UTC 2017
#38173: Meta query creates unecessary multiple left joins when using the same meta
key
--------------------------+------------------------------
Reporter: neonWired | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Database | Version: 4.6
Severity: normal | Resolution:
Keywords: | Focuses: performance
--------------------------+------------------------------
Comment (by tamiassibiricus):
Got same situation when have about 10000 posts in WP setup and need to
filter by meta that filled for all posts quantity(each post have value for
meta). So we have same meta qty that could joined twice or more.
When mysql join meta vertical tables it join each 10000 records and then
shrink results by conditions placed in Where section.
it could really slow down mysql selects at first run.
working and tested solution -
https://gist.github.com/TamiasSibiricus/917b3dfc2b13b97e644ea739a1a1a306
--
Ticket URL: <https://core.trac.wordpress.org/ticket/38173#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list