[wp-trac] [WordPress Trac] #58593: Slow list of posts in the admin panel (with a large wp_posts table)

WordPress Trac noreply at wordpress.org
Wed Jun 21 17:23:18 UTC 2023


#58593: Slow list of posts in the admin panel (with a large wp_posts table)
-----------------------------------------+-----------------------------
 Reporter:  Shoorf                       |      Owner:  (none)
     Type:  enhancement                  |     Status:  new
 Priority:  normal                       |  Milestone:  Awaiting Review
Component:  Query                        |    Version:  6.2.2
 Severity:  normal                       |   Keywords:
  Focuses:  administration, performance  |
-----------------------------------------+-----------------------------
 Hello. With a large wp_posts table (more than 1 GB, more than 100k
 published posts), the list of posts in the admin panel may open for
 several seconds. Slow SQL query that calculates the number of "my" posts:
                                 SELECT COUNT( 1 )
                                 FROM wp_posts
                                 WHERE post_type = '<post_type>'
                                 AND post_status NOT IN ( 'trash','auto-
 draft','inherit','request-pending','request-confirmed','request-failed
 ','request-completed' )
                                 AND post_author = 1

 Solution:

   ALTER TABLE `wp_posts`
   ADD KEY `type_status_author` (
   `post_type`,
   `post_status`,
   `post_author`
   );

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


More information about the wp-trac mailing list