Slow query issue when setting up sitemap
-
Hello.
Since the sitemap is not generated with the url,
I tested it with the yoast sitemap cli plugin.
A slow query error is exposed during the generation log, but the sitemap is created.(WordPress database error Query execution was interrupted, maximum statement execution time exceeded for query)
It seems to be a query to check if the user has capabilities with the ‘_yoast_wpseo_profile_updated’ key in usermeta.
[mysql explain]
+—-+————-+—————+————+——–+——————+———-+———+———-+———-+———————————————-+
| id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+—-+————-+—————-+————+——–+——————+———+———+————–+———————————————-+
| 1 | SIMPLE | mt1 | NULL | ref | user_id,meta_key | meta_key | 767 | const | 2684608 | 65.35 | Using where; Using temporary; Using filesort |I would like to ask if it is possible to skip this step.
Thank you.
SELECT wp_users.ID
FROM wp_users LEFT JOIN wp_usermeta ON ( wp_users.ID = wp_usermeta.user_id AND wp_usermeta.meta_key = '_yoast_wpseo_profile_updated' ) LEFT JOIN wp_usermeta AS mt1 ON ( wp_users.ID = mt1.user_id ) LEFT JOIN wp_usermeta AS mt2 ON ( wp_users.ID = mt2.user_id )
WHERE 1=1 AND (
(
(
(
(
wp_usermeta.user_id IS NULL
)
AND
(
(
(
( mt1.meta_key = 'wp_capabilities' AND mt1.meta_value LIKE '%\"edit\_posts\"%' )
OR
( mt1.meta_key = 'wp_capabilities' AND mt1.meta_value LIKE '%\"administrator\"%' )
OR
( mt1.meta_key = 'wp_capabilities' AND mt1.meta_value LIKE '%\"editor\"%' )
OR
( mt1.meta_key = 'wp_capabilities' AND mt1.meta_value LIKE '%\"contrbutor\"%' )
OR
( mt1.meta_key = 'wp_capabilities' AND mt1.meta_value LIKE '%\"author\"%' )
OR
( mt1.meta_key = 'wp_capabilities' AND mt1.meta_value LIKE '%\"subscriber\"%' )
OR
( mt1.meta_key = 'wp_capabilities' AND mt1.meta_value LIKE '%\"contributor\"%' )
)
)
)
)
)
AND
(
mt2.meta_key = 'wp_capabilities'
)
)
)
ORDER BY user_login ASCThe page I need help with: [log in to see the link]
- You must be logged in to reply to this topic.