about summary refs log tree commit diff
path: root/app/controllers/accounts_controller.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2020-12-07 12:08:30 +0100
committerGitHub <noreply@github.com>2020-12-07 12:08:30 +0100
commit48bef17cc990afda95c4de657f7643c321e62650 (patch)
tree01636821b1bbf46667e625bd842ee0bde65470d8 /app/controllers/accounts_controller.rb
parenta8c471fcc043b61aa10cf8f849dfb552db7381d3 (diff)
Fix slow distinct queries where grouped queries are faster (#15287)
About 2x speed-up on inboxes query
Diffstat (limited to 'app/controllers/accounts_controller.rb')
-rw-r--r--app/controllers/accounts_controller.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb
index ccb5ef8e8..b902ada09 100644
--- a/app/controllers/accounts_controller.rb
+++ b/app/controllers/accounts_controller.rb
@@ -81,7 +81,7 @@ class AccountsController < ApplicationController
   end
 
   def account_media_status_ids
-    @account.media_attachments.attached.reorder(nil).select(:status_id).distinct
+    @account.media_attachments.attached.reorder(nil).select(:status_id).group(:status_id)
   end
 
   def no_replies_scope