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 `TableName` ADD INDEX `tablename_idx_first_name_last_name_person_id` (`first_name`,`last_name`,`person_id`);
SELECT
COUNT(*)
FROM
TableName AS a,
TableName AS b
WHERE
a.first_name = b.first_name
AND a.last_name = b.last_name
AND a.person_id < b.person_id