mirror of
https://github.com/discourse/discourse.git
synced 2025-05-28 13:51:18 +08:00
PERF: Load topic bookmarks for the user in user_post_bookmarks (#10197)
Instead of loading all of the user bookmarks using all the post IDs in a topic, load all the bookmarks for a user using the topic ID. This eliminates a costly WHERE ID IN query.
This commit is contained in:
@ -435,7 +435,7 @@ class TopicView
|
||||
end
|
||||
|
||||
def user_post_bookmarks
|
||||
@user_post_bookmarks ||= Bookmark.where(user: @user, post_id: unfiltered_post_ids)
|
||||
@user_post_bookmarks ||= @topic.bookmarks.where(user: @user)
|
||||
end
|
||||
|
||||
def reviewable_counts
|
||||
|
Reference in New Issue
Block a user