This query gets me the profiles with the most evidence records when the profile is the actor. Is there any way to make it faster in a mysql query?
SELECT profiles.*, count(*) AS counted_profiles
FROM `profiles`
INNER JOIN (SELECT ev.actor_id
FROM evidences AS ev
WHERE ev.actor_type = 'Profile') AS ev2
ON ev2.actor_id = profiles.id
GROUP BY ev2.actor_id
ORDER BY counted_profiles DESC LIMIT 10