[wp-trac] [WordPress Trac] #45354: Adding index for meta_key and post_id in postmeta

WordPress Trac noreply at wordpress.org
Tue Sep 28 04:53:15 UTC 2021


#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                      |  Resolution:
 Keywords:  needs-testing dev-feedback  |     Focuses:  performance
----------------------------------------+------------------------------

Comment (by galbaras):

 I'd say an index like this is beneficial if it helps frontend visitors, or
 if it helps backend users without causing any frontend delays. With the
 wide variety of plugins that use post meta, this may be difficult to
 determine, so maybe site admins should consider this on a site-by-site
 basis.

 @fliespl @DuckDagobert Have you tested both "post_id, meta_key" and
 "meta_key, post_id" to see which one is faster? These columns vary in
 cardinality and speed of comparison, so one may be better than the other.

 Also, have you measured the impact on both frontend and backend? Can you
 share more contextual details?

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


More information about the wp-trac mailing list