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 `table1` ADD INDEX `table1_idx_name1` (`name1`);
ALTER TABLE `table2` ADD INDEX `table2_idx_name2` (`name2`);
SELECT
DISTINCT table1.name1
FROM
table1,
table2
WHERE
table1.name1 = table2.name2