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 `event` ADD INDEX `event_idx_event_id` (`event_id`);
ALTER TABLE `schedule` ADD INDEX `schedule_idx_schedule_id_event_id` (`schedule_id`,`event_id`);
ALTER TABLE `team` ADD INDEX `team_idx_schedule_id` (`schedule_id`);
SELECT
*
FROM
team
WHERE
EXISTS (
SELECT
1
FROM
(SELECT
team.team_id,
es_temp1.members
FROM
team,
schedule,
event
LEFT JOIN
es_temp1
ON es_temp1.team_id = team.team_id
WHERE
team.schedule_id = schedule.schedule_id
AND schedule.event_id = event.event_id
AND event.event_id = 183) AS t
WHERE
(
members = 0
)
AND (
team.team_id = t.team_id
)
)