[wp-trac] [WordPress Trac] #33885: meta_form performs a potentially expensive query

WordPress Trac noreply at wordpress.org
Wed Feb 2 10:32:30 UTC 2022

#33885: meta_form performs a potentially expensive query
 Reporter:  jorbin                               |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  6.0
Component:  Administration                       |     Version:  4.3.1
 Severity:  critical                             |  Resolution:
 Keywords:  has-patch needs-testing needs-unit-  |     Focuses:
  tests                                          |  performance

Comment (by robscott):

 I like the idea of this plugin, very much - I will certainly check it out
 and contribute some help with it with a view to using it in flight!

 I just noticed @OllieJones comment - which is very well reasoned indeed -
 however, I would like to point out that meta_key of more than 191
 characters would be considered pretty absurd AND if we changed the
 definition of the table, we very likely, in 99.99% of cases, wouldn't be
 TOUCHING the data... at all.

 And in fact, we could set core to update the table only if the table did
 not contain data of more than 191 chars. It's borderline "wrong" to have a
 meta KEY that long. I can't think of any circumstances where this would
 happen on purpose.

 So how many of "zillions of sites" would we kill if we updated this? A
 number close to zero may be my guess! I've implemented this potentially
 thousands of times, with a query which first checks for meta_key which is
 greater than 191 chars, and it literally never happened.

 I agree about indexes - absolutely. Just the underlying logic - who is
 using a meta key which is between 191 and 255 characters in length? That's
 longer than a full Tweet?!

Ticket URL: <https://core.trac.wordpress.org/ticket/33885#comment:88>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list