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 `time` ADD INDEX `time_idx_user_id_start_time_end_time` (`user_id`,`start_time`,`end_time`);
SELECT time.start_time, time.end_time, SUM(TIMESTAMPDIFF(second, time.start_time, time.end_time) / 60) AS `Time Diff` FROM time WHERE time.start_time >= DATE_SUB(NOW(), INTERVAL 15 DAY) AND time.user_id = 'xx' GROUP BY time.start_time, time.end_time ORDER BY NULL