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 `temp_final` ADD INDEX `temp_final_idx_reid_n_rei_retyp_n_ret_sid_c_sid` (`reid`,`n_reid`,`retype`,`n_retype`,`sid`,`c_sid`);
SELECT
t.name
FROM
temp_final t
WHERE
t.reid = t.n_reid
AND t.retype = t.n_retype
AND t.sid = t.c_sid
AND t.pid = t.n_pid