Unless you are fetching millions of rows,
the problem is most likely not in the query,
but in the amount of queries.
You are probably iterating over an entity and making many queries per each entity,
which kills performance (also known as the N+1 queries problem).
For example in the case of the engagement logs,
every engagement was iterated over and