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 `chauntry` ADD INDEX `chauntry_idx_mailing_indicator` (`mailing_indicator`);
ALTER TABLE `chauntry` ADD INDEX `chauntry_idx_added` (`added`);
ALTER TABLE `chauntry` ADD INDEX `chauntry_idx_email` (`email`);
SELECT
*
FROM
(SELECT
DISTINCT chauntry.email,
chauntry.title,
chauntry.first_name,
chauntry.last_name,
'chauntry' AS source,
chauntry.post_code AS postcode
FROM
chauntry
WHERE
chauntry.mailing_indicator = 1) AS x
JOIN
(
SELECT
chauntry.email,
Avg(chauntry.amount_paid) AS avg_paid,
Count(*) AS no_times_booked,
Count(DISTINCT (Date_format(chauntry.added,
'%M %Y'))) AS unique_months
FROM
chauntry
WHERE
chauntry.added >= Now() - INTERVAL 1 year
GROUP BY
chauntry.email
ORDER BY
NULL
) AS y
ON x.email = y.email