In case you have your own slow SQL query, you can optimize it automatically here.
For the query above, the following recommendations will be helpful as part of the SQL tuning process.
You'll find 3 sections below:
ALTER TABLE `node` ADD INDEX `node_idx_status_type` (`status`,`type`);
ALTER TABLE `node_access` ADD INDEX `node_access_idx_nid_grant_view` (`nid`,`grant_view`);
ALTER TABLE `taxonomy_index` ADD INDEX `taxonomy_index_idx_tid` (`tid`);
ALTER TABLE `taxonomy_term_data` ADD INDEX `taxonomy_data_idx_tid` (`tid`);
ALTER TABLE `taxonomy_vocabulary` ADD INDEX `taxonomy_vocabular_idx_vid_machine_name` (`vid`,`machine_name`);
SELECT
DISTINCT node.nid AS nid,
node.title AS node_title,
node.created AS node_created,
ttdn.name AS ttdn_name,
ttdn.vid AS ttdn_vid,
ttdn.tid AS ttdn_tid,
ttdn_tv.machine_name AS ttdn_tv_machine_name,
node.sticky AS node_sticky,
'node' AS field_data_field_top_image_node_entity_type,
'node' AS field_data_field_summary_node_entity_type,
'node' AS field_data_body_node_entity_type,
'node' AS field_data_field_tags_node_entity_type
FROM
node
LEFT JOIN
(
SELECT
td.*,
tn.nid AS nid
FROM
taxonomy_term_data td
INNER JOIN
taxonomy_vocabulary tv
ON td.vid = tv.vid
LEFT JOIN
taxonomy_index tn
ON tn.tid = td.tid
WHERE
(
tv.machine_name IN (
'news_categories'
)
)
AND (
td.tid IN (
'10', '21', '23', '24', '25', '26', '27', '28', '31', '32', '33'
)
)
) ttdn
ON node.nid = taxonomy_term_data_node.nid
LEFT JOIN
taxonomy_vocabulary ttdn_tv
ON ttdn.vid = ttdn_tv.vid
WHERE
(
(
(
node.status = '1'
)
AND (
node.type IN (
'news_feed', 'www_news_releases_feed', 'article', 'www_rru_in_the_media_feed'
)
)
)
)
AND (
EXISTS (
SELECT
na.nid AS nid
FROM
node_access na
WHERE
(
(
(
na.gid = '0'
)
AND (
na.realm = 'all'
)
)
OR (
(
na.gid = '1'
)
AND (
na.realm = 'taxonomy_access_role'
)
)
)
AND (
na.grant_view >= '1'
)
AND (
node.nid = na.nid
)
)
)
ORDER BY
node_sticky DESC,
node_created DESC LIMIT 1 OFFSET 0