Query running too long
-
Hi Team,
Our application is struggling with these long running queries:
SELECT
post_type, MAX( GREATEST( p.post_modified_gmt, p.post_date_gmt ) ) AS date
FROM wp_posts as p
LEFT JOIN wp_postmeta AS pm ON ( p.ID = pm.post_id AND pm.meta_key = 'rank_math_robots')
WHERE (
(pm.meta_key = 'rank_math_robots' AND pm.meta_value NOT LIKE '%noindex%')
OR pm.post_id IS NULL
)
AND p.post_status IN ( 'publish','inherit' )
AND p.post_type IN ('post','page','attachment') // and custom types etc.
GROUP BY p.post_type
ORDER BY p.post_modified_gmt DESC;as well as
SELECT
SQL_CALC_FOUND_ROWS wp_posts.ID
FROM wp_posts
LEFT JOIN wp_postmeta AS sq1 ON ( wp_posts.ID = sq1.post_id AND sq1.meta_key = '_wp_attached_file' )
WHERE 1=1 AND wp_posts.ID NOT IN (0)
AND (
(
(wp_posts.post_title LIKE '%string1%') OR (wp_posts.post_excerpt LIKE '%string1%') OR
(wp_posts.post_content LIKE '%string1%') OR (sq1.meta_value LIKE '%string1%')
) AND (
(wp_posts.post_title LIKE '%string2%') OR (wp_posts.post_excerpt LIKE '%string2%') OR
(wp_posts.post_content LIKE '%string2%') OR (sq1.meta_value LIKE '%string2%')
)
) AND wp_posts.post_type = 'attachment'
AND ((wp_posts.post_status = 'inherit' OR wp_posts.post_status = 'private'))
GROUP BY wp_posts.ID
ORDER BY wp_posts.post_date DESC
LIMIT 0, 80;
// 'string1' and 'string2' for illustration purposesIs it possible to defer them to a controlled environment such as CLI so they can run on a specific time of day? Or potentially cache the result once a day?
The enabled modules in
RankMath -> Dashboardare:- Local SEO
- Schema (Structured Data)
- Sitemap
- Video Sitemap
- React Setting UI
My environment settings are:
PHP Memory limit: 2G
Max input time: 600
PHP time limit: 150
PHP max input variables: 4500Thanks in advance
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
You must be logged in to reply to this topic.