discourse/app
Alan Guo Xiang Tan ddb458343d
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.
2021-09-15 10:29:42 +08:00
..
assets DEV: Change to show failed tests only Ember tests (#14335) 2021-09-15 08:31:37 +10:00
controllers PERF: Improve query performance all inbox private messages. (#14304) 2021-09-15 10:29:42 +08:00
helpers DEV: Allow us to use Ember CLI assets in production 2021-08-05 08:32:33 -04:00
jobs DEV: Ignore bookmarks.topic_id column and remove references to it in code (#14289) 2021-09-15 10:16:54 +10:00
mailers UX: suspend forever time period messages (#13776) 2021-07-20 14:42:08 +04:00
models DEV: Add for_topic column to bookmarks (#14343) 2021-09-15 11:29:22 +10:00
serializers DEV: Ignore bookmarks.topic_id column and remove references to it in code (#14289) 2021-09-15 10:16:54 +10:00
services FEATURE: remove duplicated messages about new advices (#14319) 2021-09-15 08:59:25 +10:00
views DEV: Ignore bookmarks.topic_id column and remove references to it in code (#14289) 2021-09-15 10:16:54 +10:00