Query in MYSQL takes 160 seconds to execute .. help please

1

This is the query in question, it's from a Wordpress theme

SELECT DISTINCT SQL_CALC_FOUND_ROWS wp_posts.*
FROM wp_posts
INNER JOIN wp_postmeta ON (wp_posts.id = wp_postmeta.post_id)
LEFT JOIN wp_options ON wp_options.option_name LIKE Concat('_ait_directory2_elements_opts_page_', wp_posts.id)
WHERE 1 = 1
  AND (((((Find_in_set(wp_posts.id,
                         (SELECT DISTINCT Group_concat(post_id) AS ids
                          FROM wp_postmeta AS postmeta
                          WHERE postmeta.meta_value LIKE '%r%'
                            AND postmeta.meta_key IN ('subtitle', 'features_search_string') )))
          OR (wp_posts.post_title LIKE '%r%')
          OR (wp_posts.post_content LIKE '%r%')))
        OR ((option_value LIKE '%r%'))))
  AND (wp_postmeta.meta_key = '_ait-item_item-featured')
  AND wp_posts.post_type = 'ait-item'
  AND (wp_posts.post_status = 'publish'
       OR wp_posts.post_author = 58
       AND wp_posts.post_status = 'private')
GROUP BY wp_posts.id
ORDER BY Cast(wp_postmeta.meta_value AS CHAR) DESC, wp_posts.post_date ASC LIMIT 0, 5;

in mysqltuner it tells me that I have a query without index and I have already configured all the my.cnf well, but I do not know what else to do

    
asked by dev 11.09.2016 в 19:50
source

0 answers