Hallo!
Ich habe ein Problem mit einer Site, bei der folgende SQL-Query sehr lange dauert:
SQL
SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts LEFT JOIN wp_postmeta ON ( wp_posts.ID = wp_postmeta.post_id ) LEFT JOIN wp_postmeta AS mt1 ON ( wp_posts.ID = mt1.post_id ) LEFT JOIN wp_postmeta AS mt2 ON (wp_posts.ID = mt2.post_id AND mt2.meta_key = 'atkp_product_asintype' ) LEFT JOIN wp_postmeta AS mt3 ON ( wp_posts.ID = mt3.post_id ) LEFT JOIN wp_postmeta AS mt4 ON (wp_posts.ID = mt4.post_id AND mt4.meta_key = 'atkp_product_updatedon' ) WHERE 1=1 AND ( ( wp_postmeta.meta_key = 'atkp_product_shopid' AND wp_postmeta.meta_value = '47370' ) AND ( ( mt1.meta_key = 'atkp_product_asintype' AND mt1.meta_value = 'ASIN' ) OR mt2.post_id IS NULL ) AND ( ( mt3.meta_key = 'atkp_product_updatedon' AND CAST(mt3.meta_value AS SIGNED) < '1530701757' ) OR ( mt3.meta_key = 'atkp_product_updatedon' AND mt3.meta_value = '' ) OR mt4.post_id IS NULL ) ) AND wp_posts.post_type = 'atkp_product' AND ((wp_posts.post_status = 'publish' OR wp_posts.post_status = 'draft')) GROUP BY wp_posts.ID LIMIT 0, 10
Die Query läuft bei mir per WP-Cron und der läuft per CLI, rennt also nicht gegen ein Timeout des Webservers. Des weiteren lockt die Query die wp_postmeta-Tabelle (warum eigentlich?) und somit "steht" die komplette Site.
Grüße, Matthias