[wp-trac] [WordPress Trac] #36625: Don't CAST the post meta value to CHAR in meta query

WordPress Trac noreply at wordpress.org
Fri Apr 22 15:03:32 UTC 2016


#36625: Don't CAST the post meta value to CHAR in meta query
-------------------------+------------------------------
 Reporter:  ericlewis    |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Query        |     Version:  3.1
 Severity:  normal       |  Resolution:
 Keywords:               |     Focuses:
-------------------------+------------------------------

Comment (by boonebgorges):

 See also #27272.

 > Removing this cast in the SQL generated by WP_Query allows users to add
 an index for the meta_value column and have that index considered for use
 by the MySQL optimizer on execution.

 Can we get some more technical details on how the optimizer decides
 whether the index can be used? When you add an index to the `meta_value`
 LONGTEXT column, you'll have to specify an index length. How does MySQL
 decide whether that index can be used? What happens when your index is 8
 characters, and the `meta_value` from your `meta_query` is 12 characters?
 (These are genuine questions - I don't know, and I'm having a hard time
 finding documentation about it.)

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


More information about the wp-trac mailing list