[wp-trac] [WordPress Trac] #45354: Adding index for meta_key and post_id in postmeta
WordPress Trac
noreply at wordpress.org
Wed Nov 14 21:43:31 UTC 2018
#45354: Adding index for meta_key and post_id in postmeta
--------------------------+-----------------------------
Reporter: DuckDagobert | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Database | Version:
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
We should add an index on post_id and meta_key as queries that contain
these columns are incredibly common (even in loop in core on every page
load basically).
An index will improve query speed up to 100% even when only 1000 posts are
in db.
Test it yourself:
{{{
ALTER TABLE `wp_postmeta` ADD INDEX `wp_postmeta_key_id`
(`meta_key`,`post_id`);
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/45354>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list