[wp-trac] [WordPress Trac] #15499: Add an index for get_lastpostmodified query

WordPress Trac noreply at wordpress.org
Sun Aug 14 18:34:30 UTC 2022


#15499: Add an index for get_lastpostmodified query
------------------------------------+-----------------------------
 Reporter:  simonwheatley           |       Owner:  SergeyBiryukov
     Type:  enhancement             |      Status:  reviewing
 Priority:  normal                  |   Milestone:  Future Release
Component:  Database                |     Version:  3.0.1
 Severity:  normal                  |  Resolution:
 Keywords:  has-patch dev-feedback  |     Focuses:  performance
------------------------------------+-----------------------------

Comment (by aliragab):

 Before the index

 {{{
 # Query_time: 20.442996  Lock_time: 0.000056  Rows_sent: 1  Rows_examined:
 214661
 # Rows_affected: 0  Bytes_sent: 139
 SET timestamp=1660498161;
 SELECT post_modified_gmt FROM ***_posts WHERE post_status = 'publish' AND
 post_type IN ('post', 'page', 'attachment') ORDER BY post_modified_gmt
 DESC LIMIT 1;
 }}}

 These 20sec droped to only 0.4sec after applying index.

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


More information about the wp-trac mailing list