Query optimization for top reactions. (#20047)

This commit is contained in:
Martin Kraft
2022-04-22 13:22:07 -04:00
committed by GitHub
parent 0b9f8ef284
commit f460401cf2

View File

@@ -262,11 +262,10 @@ func (s *SqlReactionStore) GetTopForTeamSince(teamID string, userID string, sinc
FROM
Reactions
INNER JOIN Posts ON Reactions.PostId = Posts.Id
INNER JOIN Channels ON Posts.ChannelId = Channels.Id
INNER JOIN PublicChannels ON Posts.ChannelId = PublicChannels.Id
WHERE
Reactions.DeleteAt = 0
AND Channels.Type = 'O'
AND Channels.TeamId = ?
AND PublicChannels.TeamId = ?
AND Reactions.CreateAt > ?
GROUP BY
Reactions.EmojiName)) AS A