[wp-trac] [WordPress Trac] #55223: Caching this query can yield significant performance benefit for admin screen
WordPress Trac
noreply at wordpress.org
Tue Feb 22 04:50:32 UTC 2022
#55223: Caching this query can yield significant performance benefit for admin
screen
-------------------------------+-----------------------------
Reporter: srikanthmeenakshi | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Query | Version: 5.9
Severity: normal | Keywords:
Focuses: performance |
-------------------------------+-----------------------------
Hi, Whenever the posts or pages listings are accessed from the admin
dashboard, this query gets run:
{{{
SELECT wp_prefix_users.id,
wp_prefix_users.user_login,
wp_prefix_users.display_name
FROM wp_prefix_users
INNER JOIN wp_prefix_usermeta
ON ( wp_prefix_users.id = wp_prefix_usermeta.user_id )
WHERE 1 = 1
AND ((( ( wp_prefix_usermeta.meta_key = 'wp_prefix_capabilities'
AND wp_prefix_usermeta.meta_value LIKE
'%\"edit\\_posts\"%' )
OR ( wp_prefix_usermeta.meta_key =
'wp_prefix_capabilities'
AND wp_prefix_usermeta.meta_value LIKE
'%\"administrator\"%' )
OR ( wp_prefix_usermeta.meta_key =
'wp_prefix_capabilities'
AND wp_prefix_usermeta.meta_value LIKE '%\"editor\"%'
)
OR ( wp_prefix_usermeta.meta_key =
'wp_prefix_capabilities'
AND wp_prefix_usermeta.meta_value LIKE '%\"author\"%'
)
OR ( wp_prefix_usermeta.meta_key =
'wp_prefix_capabilities'
AND wp_prefix_usermeta.meta_value LIKE
'%\"contributor\"%'
)
OR ( wp_prefix_usermeta.meta_key =
'wp_prefix_capabilities'
AND wp_prefix_usermeta.meta_value LIKE
'%\"shop\\_manager\"%' )
ORDER BY display_name ASC
}}}
This query with multiple 'like' clauses performs terribly. And it does not
look like the results are cached. Considering that this is a static query
whose results are unlikely to change frequently, this is an ideal query
for caching and improving the performance of page and posts listings.
Thanks.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/55223>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list