discourse/app/controllers/admin
Alan Guo Xiang Tan 684569c30e
PERF: Avoid slow preloading in SiteSerializer (#33283)
`SiteSerializer#post_action_types` and `SiteSerializer#topic_flag_types`
both call the `Flag.used_flag_ids` method which executes queries that
becomes very slow on sites with alot of records in either the
`post_actions` or `reviewable_scores` table.

On the `post_actions` table, we execute `SELECT DISTINCT
post_action_type_id FROM post_actions`. On the `reviewable_scores`
table, we execute `SELECT DISTINCT reviewable_scope_type FROM
reviewable_scopes`. The problem with both queries is that it requires
the PG planner to scan through every single row in those tables.

For our use case, all we actually need is to check if a flag is being
referenced by a record in either the `post_actions` or
`reviewable_scores` tables. This commit updates the `Flag.used_flag_ids`
to accept a `flag_ids`
argument and use the argument to check whether the flag ids are
referenced in the `post_action_type_id` or `reviewable_scope_type`
foreign keys.
2025-06-25 15:03:34 +08:00
..
config PERF: Avoid slow preloading in SiteSerializer (#33283) 2025-06-25 15:03:34 +08:00
admin_controller.rb DEV: Drop WithServiceHelper 2024-09-05 09:58:20 +02:00
admin_notices_controller.rb DEV: Make params explicit for services in controllers 2024-10-03 16:56:39 +09:00
api_controller.rb DEV: Require at least one scope for API key granular mode (#31253) 2025-02-10 13:22:08 +08:00
backups_controller.rb FIX: allow to email backup even if backups disabled (#32415) 2025-04-23 11:04:41 +08:00
badges_controller.rb UX: Easily toggle badges in admin badge list (#20225) 2023-02-09 11:36:27 -08:00
color_schemes_controller.rb FIX: exclude experimental system theme palettes (#33267) 2025-06-20 13:44:18 +08:00
dashboard_controller.rb FEATURE: Allow admins to force refresh "What's new?" (#29911) 2024-11-27 09:40:55 +10:00
email_controller.rb DEV: Add e-mail site settings to e-mail admin page (#32214) 2025-04-08 18:59:50 +08:00
email_logs_controller.rb DEV: Extract e-mail logs into their own admin page (#32211) 2025-04-08 17:50:12 +08:00
email_styles_controller.rb FEATURE: customization of html emails (#7934) 2019-07-30 15:05:08 -04:00
email_templates_controller.rb FEATURE: send email to deleted user (#31947) 2025-03-24 14:45:25 +08:00
embeddable_hosts_controller.rb UX: admins embedding page follows admin ux guideline (#30122) 2025-01-06 13:01:08 +11:00
embedding_controller.rb UX: admins embedding page follows admin ux guideline (#30122) 2025-01-06 13:01:08 +11:00
emoji_controller.rb DEV: Move admin config pages out of /customize/ sub-route (#30511) 2025-01-02 09:13:11 +10:00
form_templates_controller.rb DEV: Show form templates in the composer (#21190) 2023-05-29 14:47:18 -07:00
groups_controller.rb DEV: Add dedicated admin groups page (#32377) 2025-04-22 11:23:25 +08:00
impersonate_controller.rb DEV: Apply syntax_tree formatting to app/* 2023-01-09 14:14:59 +00:00
permalinks_controller.rb FIX: Permalink.create didn't work as expected anymore (#29895) 2024-11-22 21:11:26 +01:00
plugins_controller.rb FIX: Don't allow access to plugin page if plugin is not visible (#26431) 2024-04-02 16:26:15 +03:00
reports_controller.rb DEV: Refactor reports index into service (#31667) 2025-03-11 14:36:06 +10:00
robots_txt_controller.rb FIX: Show true content of robots.txt after restoring to default (#24980) 2023-12-20 23:00:37 +03:00
screened_emails_controller.rb SECURITY: Moderators cannot see user emails. 2024-12-19 13:13:18 -03:00
screened_ip_addresses_controller.rb DEV: Apply syntax_tree formatting to app/* 2023-01-09 14:14:59 +00:00
screened_urls_controller.rb DEV: Apply syntax_tree formatting to app/* 2023-01-09 14:14:59 +00:00
search_controller.rb DEV: Refactor reports index into service (#31667) 2025-03-11 14:36:06 +10:00
search_logs_controller.rb DEV: Apply syntax_tree formatting to app/* 2023-01-09 14:14:59 +00:00
section_controller.rb DEV: Add a skeleton for section landing page & items (#28477) 2024-10-02 12:19:38 +10:00
site_settings_controller.rb FEATURE: porting type object to site settings (#32706) 2025-05-13 14:30:24 -03:00
site_texts_controller.rb FEATURE: Allow showing site text search in selected locale (#28453) 2024-08-26 11:25:36 +10:00
staff_action_logs_controller.rb FEATURE: Log tag group changes in staff action log (#28787) 2024-09-09 10:50:48 +08:00
staff_controller.rb DEV: Drop WithServiceHelper 2024-09-05 09:58:20 +02:00
themes_controller.rb DEV: Partially refactor themes controller to services (#33141) 2025-06-23 10:14:58 +10:00
unknown_reviewables_controller.rb FEATURE: Gracefully handle unhandled reviewables (#31118) 2025-02-05 14:38:45 +11:00
user_fields_controller.rb DEV: Modernize admin user fields (#29843) 2024-11-25 11:54:43 +08:00
users_controller.rb DEV: revert admin users list change (#32723) 2025-05-15 09:48:01 +02:00
versions_controller.rb Refactor admin base controller (#18453) 2022-10-31 12:02:26 +00:00
watched_words_controller.rb FIX: Ensure uploaded watched word CSVs are converted to utf-8. (#32263) 2025-04-11 16:12:45 +10:00
web_hooks_controller.rb FEATURE: Add Mechanism to redeliver all failed webhook events (#27609) 2024-07-08 15:43:16 -05:00