Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #39768, comment 9


Ignore:
Timestamp:
12/22/2019 06:22:43 PM (6 years ago)
Author:
SergeyBiryukov
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #39768, comment 9

    initial v1  
    1010Using `CONVERT()` appears to be a better option. While `utf8mb4` should be available on any modern install, that may not always be the case, so we have to check for it specifically, and fall back to the current query otherwise. This option also has some performance difference from the queries above in my testing:
    1111{{{
    12 SELECT post_id FROM wp_postmeta WHERE meta_key = '_wp_attached_file' AND meta_value = CONVERT( %s USING utf8mb4 ) COLLATE utf8mb4_bin
     12SELECT post_id FROM wp_postmeta WHERE meta_key = '_wp_attached_file' AND meta_value = CONVERT( '2009/03/myimage.jpg' USING utf8mb4 ) COLLATE utf8mb4_bin
    1313Query took 0.0315 seconds
    1414}}}