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:
SELECT
ROUND(AVG(attendance)),
games.competition,
games.team1,
countries.*
FROM
games
LEFT JOIN
(
teams
INNER JOIN
countries
ON (
countries.iso3 = teams.country
)
LEFT JOIN
altnames
ON (
altnames.entityType = 'team'
AND altnames.season = '1011'
AND altnames.entityId = teams.longName
)
)
ON (
altnames.altValue = games.team1
OR teams.longName = games.team1
)
WHERE
games.season = '1011'
GROUP BY
games.competition,
games.team1
HAVING
AVG(attendance) >= 500
ORDER BY
AVG(attendance) DESC