FIX: more performance improvement for PostAlert job (#22487)

Simplified query based on SiteSettings to join only relevant user_options rows.
In addition, index was added to 'watched_precedence_over_muted` column in `user_options` table to speed up query
This commit is contained in:
Krzysztof Kotlarek
2023-07-13 09:02:23 +10:00
committed by GitHub
parent 4d5f9b8a21
commit bdecd697b9
7 changed files with 50 additions and 19 deletions

View File

@ -0,0 +1,7 @@
# frozen_string_literal: true
class AddWatchedPrecedenceOverMutedIndexToUserOptions < ActiveRecord::Migration[7.0]
def change
add_index :user_options, :watched_precedence_over_muted
end
end

View File

@ -0,0 +1,7 @@
# frozen_string_literal: true
#
class AddTopicIdNotificationLevelIndexToTopicUsers < ActiveRecord::Migration[7.0]
def change
add_index :topic_users, %i[topic_id notification_level]
end
end

View File

@ -0,0 +1,7 @@
# frozen_string_literal: true
class AddCategoryIdNotificationLevelIndexToCategoryUsers < ActiveRecord::Migration[7.0]
def change
add_index :category_users, %i[category_id notification_level]
end
end