Hello,
when more than 5 friends connections are established, the page slow down the load time to 7 or more seconds.
The query that causes this big delay is included at bottom. It needs an urgent optimization.
Thank you.
Best regards,
Carlos.
SELECT b.`id` FROM ( SELECT action.`id`, action.`entityId`, action.`entityType`, action.`pluginKey`, action.`data`, activity.timeStamp FROM bgs_newsfeed_action action INNER JOIN bgs_newsfeed_activity activity ON action.id = activity.actionId INNER JOIN `bgs_newsfeed_action_set` cactivity ON action.id = cactivity.actionId INNER JOIN `bgs_base_user` base_user_table_alias ON base_user_table_alias.`id` = `cactivity`.`userId` LEFT JOIN `bgs_base_user_suspend` base_user_suspend_table_alias ON base_user_suspend_table_alias.`userId` = `base_user_table_alias`.`id` INNER JOIN bgs_newsfeed_action_feed action_feed ON activity.id=action_feed.activityId LEFT JOIN bgs_newsfeed_follow follow ON action_feed.feedId = follow.feedId AND action_feed.feedType = follow.feedType WHERE (`base_user_suspend_table_alias`.`id` IS NULL) AND cactivity.userId = :u AND activity.status=:s AND activity.timeStamp<:st AND ( ( follow.userId=:u AND activity.visibility & :vf ) ) UNION SELECT action.`id`, action.`entityId`, action.`entityType`, action.`pluginKey`, action.`data`, activity.timeStamp FROM bgs_newsfeed_action action INNER JOIN bgs_newsfeed_activity activity ON action.id = activity.actionId INNER JOIN `bgs_newsfeed_action_set` cactivity ON action.id = cactivity.actionId INNER JOIN `bgs_base_user` base_user_table_alias ON base_user_table_alias.`id` = `cactivity`.`userId` LEFT JOIN `bgs_base_user_suspend` base_user_suspend_table_alias ON base_user_suspend_table_alias.`userId` = `base_user_table_alias`.`id` WHERE (`base_user_suspend_table_alias`.`id` IS NULL) AND cactivity.userId = :u AND activity.status=:s AND activity.timeStamp<:st AND ( ( activity.userId=:u AND activity.visibility & :va ) ) UNION SELECT action.`id`, action.`entityId`, action.`entityType`, action.`pluginKey`, action.`data`, activity.timeStamp FROM bgs_newsfeed_action action INNER JOIN bgs_newsfeed_activity activity ON action.id = activity.actionId INNER JOIN `bgs_newsfeed_action_set` cactivity ON action.id = cactivity.actionId INNER JOIN `bgs_base_user` base_user_table_alias ON base_user_table_alias.`id` = `cactivity`.`userId` LEFT JOIN `bgs_base_user_suspend` base_user_suspend_table_alias ON base_user_suspend_table_alias.`userId` = `base_user_table_alias`.`id` INNER JOIN bgs_newsfeed_action_feed action_feed ON activity.id=action_feed.activityId WHERE (`base_user_suspend_table_alias`.`id` IS NULL) AND cactivity.userId = :u AND activity.status=:s AND activity.timeStamp<:st AND ( ( action_feed.feedId=:u AND action_feed.feedType="user" AND activity.visibility & :vfeed ) ) UNION SELECT action.`id`, action.`entityId`, action.`entityType`, action.`pluginKey`, action.`data`, activity.timeStamp FROM bgs_newsfeed_action action INNER JOIN bgs_newsfeed_activity activity ON action.id = activity.actionId INNER JOIN `bgs_newsfeed_action_set` cactivity ON action.id = cactivity.actionId INNER JOIN `bgs_base_user` base_user_table_alias ON base_user_table_alias.`id` = `cactivity`.`userId` LEFT JOIN `bgs_base_user_suspend` base_user_suspend_table_alias ON base_user_suspend_table_alias.`userId` = `base_user_table_alias`.`id` INNER JOIN bgs_newsfeed_activity subscribe ON activity.actionId=subscribe.actionId and subscribe.activityType=:as AND subscribe.userId=:u WHERE (`base_user_suspend_table_alias`.`id` IS NULL) AND cactivity.userId = :u AND activity.status=:s AND activity.timeStamp<:st ) b GROUP BY b.`id` ORDER BY MAX(b.timeStamp) DESC LIMIT 0, 10