[wp-trac] [WordPress Trac] #32449: wp-admin/includes/template.php meta_form query is causing full table scans in wordpress 4.2

WordPress Trac noreply at wordpress.org
Wed May 20 20:52:09 UTC 2015


#32449: wp-admin/includes/template.php meta_form query is causing full table scans
in wordpress 4.2
--------------------------+-----------------------------
 Reporter:  jeichorn      |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  4.2.2
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 It looks like the changes to indexes for utf8_mb4 is breaking this query.

 SELECT meta_key
                 FROM $wpdb->postmeta
                 GROUP BY meta_key
                 HAVING meta_key NOT LIKE %s
                 ORDER BY meta_key
                 LIMIT %d";

 Its always doing a full table scan now.  On a site with 7 million rows in
 postmeta this takes a long time.

 I haven't been able to come up with a solution to force mysql to use the
 index.

 I've included a patch fixes the performance problem, but i'm not sure how
 much use this feature is in general.  On the site in question there are
 10k distinct meta keys that don't start with _, what does showing a random
 30 of them buy anyone?

--
Ticket URL: <https://core.trac.wordpress.org/ticket/32449>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list