discourse/app/models/concerns/reports
Natalie Tay 6b7cebdcb0
PERF: Improve trust level pipeline report (#40948)
Wraps the trust-level `action` filter in a `MATERIALIZED` CTE so
Postgres resolves those (rare) rows first via the existing
`index_staff_action_logs_on_action_and_id`, instead of mis-estimating
the unestim-able regex filters and falling back to a full-table merge
join over `target_user_id`... Same results, no new index and ~11× fewer
buffers on the 1-year range (from 230k to 20k).

| Range | baseline buffers | rewrite buffers | baseline cold | rewrite
cold |
|---|---:|---:|---:|---:|
| 7 day | 12.4k | 12.4k | 30 ms | 32 ms |
| 30 day | 12.8k | 12.8k | 29 ms | 32 ms |
| 3 month | 231k | **14k** | 103 ms | **37 ms** (2.8×) |
| 1 year | 231k | **20k** | 96 ms | **40 ms** (2.4×) |

The better improvement would be to add an index on the user_history
table. But I think we can avoid it for now.
2026-06-17 10:43:13 +08:00
..
activity_by_category.rb PERF: Improve activity by category report by doing it one-pass across the (e.g.) 2 year date period (#40945) 2026-06-16 23:45:06 +08:00
admin_logins.rb DEV: rename staff_logins report to admin_logins (#39840) 2026-05-11 10:49:09 +10:00
associated_accounts_by_provider.rb FIX: Update associated accounts report to handle Discourse Connect (#34462) 2025-08-21 13:51:06 -04:00
bookmarks.rb
consolidated_api_requests.rb DEV: Convert AdminReport component to gjs (#31011) 2025-01-29 10:33:43 +10:00
consolidated_page_views.rb DEV: Convert AdminReport component to gjs (#31011) 2025-01-29 10:33:43 +10:00
consolidated_page_views_browser_detection.rb
daily_engaged_users.rb PERF: Compute dashboard KPIs in a single pass (#40705) 2026-06-10 21:09:27 +08:00
dau_by_mau.rb PERF: Compute dashboard KPIs in a single pass (#40705) 2026-06-10 21:09:27 +08:00
emails.rb
flags.rb
flags_status.rb DEV: Convert AdminReport component to gjs (#31011) 2025-01-29 10:33:43 +10:00
likes.rb
mobile_visits.rb
moderator_warning_private_messages.rb
moderators_activity.rb DEV: Convert AdminReport component to gjs (#31011) 2025-01-29 10:33:43 +10:00
new_contributors.rb PERF: Compute dashboard KPIs in a single pass (#40705) 2026-06-10 21:09:27 +08:00
notify_moderators_private_messages.rb
notify_user_private_messages.rb
post_edits.rb SECURITY: Do not leak PM post edits to moderators 2026-03-19 15:21:28 +00:00
posters_by_member_type.rb FEATURE: Who's posting section of the dashboard engagement section (#40225) 2026-05-22 12:46:32 +08:00
posts.rb DEV: Convert AdminReport component to gjs (#31011) 2025-01-29 10:33:43 +10:00
profile_views.rb
signups.rb
site_traffic.rb FEATURE: Add site traffic dashboard section (#40023) 2026-05-19 14:08:21 +08:00
storage_stats.rb
suspicious_logins.rb FIX: Suspicious login IPs bypass the moderator IP-visibility setting (#40154) 2026-05-22 13:22:32 +08:00
system_private_messages.rb
time_to_first_response.rb DEV: Fix assigned but unused variable Prism warnings (#39436) 2026-04-22 12:42:14 +02:00
top_countries_by_browser_pageviews.rb FEATURE: Drill-down and pagination for top referrers/countries (#40364) 2026-06-02 09:57:39 +08:00
top_ignored_users.rb DEV: Convert AdminReport component to gjs (#31011) 2025-01-29 10:33:43 +10:00
top_referred_topics.rb DEV: Convert AdminReport component to gjs (#31011) 2025-01-29 10:33:43 +10:00
top_referrers.rb DEV: Convert AdminReport component to gjs (#31011) 2025-01-29 10:33:43 +10:00
top_referrers_by_browser_pageviews.rb Revert "FEATURE: Surface Direct traffic in the Top referrers dashboard card (#40470)" (#40508) 2026-06-03 10:24:24 +08:00
top_traffic_sources.rb DEV: Convert AdminReport component to gjs (#31011) 2025-01-29 10:33:43 +10:00
top_uploads.rb FEATURE: system themes (#32681) 2025-06-13 10:36:31 +08:00
top_users_by_likes_received.rb DEV: Convert AdminReport component to gjs (#31011) 2025-01-29 10:33:43 +10:00
top_users_by_likes_received_from_a_variety_of_people.rb DEV: Convert AdminReport component to gjs (#31011) 2025-01-29 10:33:43 +10:00
top_users_by_likes_received_from_inferior_trust_level.rb DEV: Convert AdminReport component to gjs (#31011) 2025-01-29 10:33:43 +10:00
topic_view_stats.rb DEV: Convert AdminReport component to gjs (#31011) 2025-01-29 10:33:43 +10:00
topics.rb
topics_with_no_response.rb
trending_search.rb DEV: Convert AdminReport component to gjs (#31011) 2025-01-29 10:33:43 +10:00
trust_level_growth.rb FIX: ensures colors are set for tl-growth report (#33294) 2025-06-21 12:55:23 +02:00
trust_level_pipeline.rb PERF: Improve trust level pipeline report (#40948) 2026-06-17 10:43:13 +08:00
user_flagging_ratio.rb DEV: Convert AdminReport component to gjs (#31011) 2025-01-29 10:33:43 +10:00
user_to_user_private_messages.rb
user_to_user_private_messages_with_replies.rb
users_by_trust_level.rb DEV: Convert AdminReport component to gjs (#31011) 2025-01-29 10:33:43 +10:00
users_by_type.rb DEV: Convert AdminReport component to gjs (#31011) 2025-01-29 10:33:43 +10:00
visits.rb UX: refactor User Visit report and layout for all reports (#37627) 2026-03-06 08:53:17 +08:00
web_crawlers.rb DEV: Convert AdminReport component to gjs (#31011) 2025-01-29 10:33:43 +10:00
web_hook_events_daily_aggregate.rb