[wp-trac] [WordPress Trac] #32361: /wp-admin/post.php is so slow because of wrong query

WordPress Trac noreply at wordpress.org
Tue May 12 17:00:02 UTC 2015


#32361: /wp-admin/post.php is so slow because of wrong query
-------------------------------+-----------------------------
 Reporter:  wolfkang           |      Owner:
     Type:  enhancement        |     Status:  new
 Priority:  normal             |  Milestone:  Awaiting Review
Component:  Posts, Post Types  |    Version:  4.2.2
 Severity:  normal             |   Keywords:
  Focuses:  performance        |
-------------------------------+-----------------------------
 I have 28,732 rows in the wp_posts table, and 1,631,109 rows in the
 wp_postmeta.

 The post edit page is so slow and its loading time is over 7 seconds.

 /wp-admin/includes/template.php shoud be modified like this.

 Before modification in line 673
 {{{
         $sql = "SELECT meta_key
                 FROM $wpdb->postmeta
                 GROUP BY meta_key
                 HAVING meta_key NOT LIKE %s
                 ORDER BY meta_key
                 LIMIT %d";
 }}}

 After modification
 {{{
         $sql = "SELECT DISTINCT meta_key
                 FROM $wpdb->postmeta
                 WHERE meta_key NOT LIKE %s
                 ORDER BY meta_key
                 LIMIT %d";
 }}}

 The grouping is not necessary.

 Please check it out.

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


More information about the wp-trac mailing list