Replies: 0
How to speed up searching? It can last for more than 30 seconds on our WordPress installation.
Maybe introducing some indexes?
SELECT SQL_CALC_FOUND_ROWS DISTINCT 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' ) LEFT JOIN wp_postmeta ON wp_posts.ID = wp_postmeta.post_id LEFT JOIN wp_term_relationships AS trel ON (wp_posts.ID = trel.object_id) LEFT JOIN wp_term_taxonomy AS ttax ON (( ttax.taxonomy = 'category_media' ) AND trel.term_taxonomy_id = ttax.term_taxonomy_id) LEFT JOIN wp_terms AS tter ON (ttax.term_id = tter.term_id) WHERE 1=1 AND wp_posts.post_type = 'attachment' AND (wp_posts.post_status = 'inherit' OR wp_posts.post_status = 'private') AND ( (wp_posts.ID LIKE '%some image%') OR (wp_posts.post_title LIKE '%some image%') OR (wp_posts.guid LIKE'%some image%') OR (wp_posts.post_content LIKE '%some image%') OR (wp_posts.post_excerpt LIKE '%some image%') OR (wp_postmeta.meta_key = '_wp_attachment_image_alt' AND wp_postmeta.meta_value LIKE '%some image%') OR (wp_postmeta.meta_key = '_wp_attached_file' AND wp_postmeta.meta_value LIKE '%some image%') OR (tter.slug LIKE '%some image%') OR (ttax.description LIKE '%some image%') OR (tter.name LIKE '%some image%') ) GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 20