[wp-trac] [WordPress Trac] #52559: When doing JOINs for meta queries the meta_key should be in the ON clause whenever possible.
WordPress Trac
noreply at wordpress.org
Mon Apr 26 07:46:01 UTC 2021
#52559: When doing JOINs for meta queries the meta_key should be in the ON clause
whenever possible.
------------------------------+------------------------------
Reporter: herregroen | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Query | Version:
Severity: normal | Resolution:
Keywords: needs-unit-tests | Focuses: performance
------------------------------+------------------------------
Comment (by jeroendk):
I encountered this issue as well for a post meta table with (only) 200k
records, for now, I "fixed" it by adding an extra index to the wp_psotmeta
table:
{{{
create index post_meta_combined_idx on wp_postmeta(post_id, meta_key)
}}}
Query times are now normal again.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/52559#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list