Permalink
Show file tree
Hide file tree
1 comment
on commit
sign in to comment.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
PERF: Improve query performance all inbox private messages. (#14304)
First reported in https://meta.discourse.org/t/-/202482/19 There are two optimizations being applied here: 1. Fetch a user's group ids in a seperate query instead of including it as a sub-query. When I tried a subquery, the query plan becomes very inefficient. 1. Join against the `topic_allowed_users` and `topic_allowed_groups` table instead of doing an IN against a subquery where we UNION the `topic_id`s from the two tables. From my profiling, this enables PG to do a backwards index scan on the `index_topics_on_timestamps_private` index. This commit fixes a bug where listing all messages was incorrectly excluding topics if a topic has been archived by a group even if the user did not belong to the group. This commit also fixes another bug where dismissing private messages selectively was subjected to the default limit of 30.
- Loading branch information
Showing
3 changed files
with
44 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ddb4583There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This commit has been mentioned on Discourse Meta. There might be relevant details there:
https://meta.discourse.org/t/inboxes-list-all-messages/203852/1