mirror of
https://github.com/discourse/discourse.git
synced 2025-01-31 11:15:14 +08:00
PERF: Prefer joins over IN ()
queries.
This commit is contained in:
parent
76569b2018
commit
63292cecd9
|
@ -23,9 +23,8 @@ class UserSearch
|
|||
users = users.where(staged: false) unless @include_staged_users
|
||||
|
||||
if @group
|
||||
users = users.where('users.id IN (
|
||||
SELECT user_id FROM group_users WHERE group_id = ?
|
||||
)', @group.id)
|
||||
users = users.joins("INNER JOIN group_users ON group_users.user_id = users.id")
|
||||
.where("group_users.group_id = ?", @group.id)
|
||||
end
|
||||
|
||||
unless @searching_user && @searching_user.staff?
|
||||
|
|
Loading…
Reference in New Issue
Block a user