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 `job_detail_history` ADD INDEX `job_history_idx_id` (`id`);
ALTER TABLE `job_detail_history` ADD INDEX `job_history_idx_start_time` (`start_time`);
SELECT
1
FROM
job_detail_history
WHERE
job_detail_history.id NOT IN (
SELECT
job_detail_history.id
FROM
job_detail_history
ORDER BY
job_detail_history.start_time DESC LIMIT 2
)