After some time digging into it looks like I have found what makes newsfeed slow....
Bellow is the query. I am not sure why do you have to inner join twise in same table...
Can someone please expaplin so i can find anoter way to dothat case obiusly current code aint working its slow as hell...
$query = 'SELECT COUNT(DISTINCT action.id) FROM ' . $this->getTableName() . ' action
INNER JOIN ' . $activityDao->getTableName() . ' activity ON action.id = activity.actionId
LEFT JOIN ' . $activityDao->getTableName() . ' pactivity ON activity.actionId = pactivity.actionId
AND (pactivity.status=:s AND pactivity.activityType=:ac AND pactivity.privacy!=:peb AND pactivity.visibility & :v)
' . $queryParts["join"] . '
WHERE ' . $queryParts["where"] . ' AND pactivity.id IS NULL AND activity.status=:s AND activity.activityType=:ac AND activity.privacy=:peb AND activity.visibility & :v';
What is the purpose of doing this....
INNER JOIN ' . $activityDao->getTableName() . ' activity ON action.id = activity.actionId
INNER JOIN ' . $activityDao->getTableName() . ' cactivity ON action.id = cactivity.actionId