Un altro modo per riscrivere questa query.
Raggruppa e conta in ogni tabella individualmente, quindi unisciti:
SELECT a.id,
COALESCE(b.t1, 0) AS t1,
COALESCE(c.t2, 0) AS t2,
COALESCE(d.t3, 0) AS t3
FROM
entity a
LEFT JOIN
( SELECT ei,
COUNT(*) AS t1
FROM table1
GROUP BY ei
) AS b
ON a.id = b.ei
LEFT JOIN
( SELECT ei,
COUNT(*) AS t2
FROM table2
GROUP BY ei
) AS c
ON a.id = c.ei
LEFT JOIN
( SELECT ei,
COUNT(*) AS t3
FROM table3
GROUP BY ei
) AS d
ON a.id = d.ei
;
Dovresti assolutamente aggiungere un indice su (ei)
su ciascuno dei 3 tavoli, se non ne hai uno.