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 `payments` ADD INDEX `payments_idx_report_cust` (`report_cust`);
ALTER TABLE `tt_emails` ADD INDEX `tt_emails_idx_customer_id` (`customer_id`);
SELECT
p.mapping
FROM
payments p
JOIN
tt_emails tmp
ON p.report_cust = tmp.customer_id
WHERE
p.report_cust IS NOT NULL