[wp-trac] [WordPress Trac] #15499: Add an index for get_lastpostmodified query
WordPress Trac
noreply at wordpress.org
Fri Jan 27 12:01:46 UTC 2023
#15499: Add an index for get_lastpostmodified query
------------------------------------+-----------------------------
Reporter: simonwheatley | Owner: SergeyBiryukov
Type: enhancement | Status: reviewing
Priority: normal | Milestone: 6.2
Component: Database | Version: 3.0.1
Severity: normal | Resolution:
Keywords: has-patch dev-feedback | Focuses: performance
------------------------------------+-----------------------------
Comment (by OllieJones):
Yes, a `$wp_db_version` bump is needed when adding an index to schema.php.
Conversations about this in @core-performance have tended in the direction
of avoiding core changes to indexes specifically for large sites, but
rather putting such changes in a a "canonical plugin". (The meaning of
"canonical plugin" is not yet defined as of this writing.)
Suggestion: add this to @rjasdfiii and my [reindexing
plugin](https://wordpress.org/plugins/index-wp-mysql-for-speed/) rather
than core.
At any rate, I'll take responsibility for this if you like.
Workaround -- use wp-cli to add the index like this:
{{{
wp db query "ALTER TABLE wp_posts ADD KEY type_status_post_date_gmt
(post_status, post_type, post_modified_gmt, post_date_gmt)
}}}
(Maybe it's time to develop an EXPLAIN addon to Query Monitor to show
query plans.)
--
Ticket URL: <https://core.trac.wordpress.org/ticket/15499#comment:55>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list