From f460401cf27c77639b649288584a4e65081c2cdb Mon Sep 17 00:00:00 2001 From: Martin Kraft Date: Fri, 22 Apr 2022 13:22:07 -0400 Subject: [PATCH] Query optimization for top reactions. (#20047) --- store/sqlstore/reaction_store.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/store/sqlstore/reaction_store.go b/store/sqlstore/reaction_store.go index 15b88678a2..c879d24041 100644 --- a/store/sqlstore/reaction_store.go +++ b/store/sqlstore/reaction_store.go @@ -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