From 48bef17cc990afda95c4de657f7643c321e62650 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Mon, 7 Dec 2020 12:08:30 +0100 Subject: Fix slow distinct queries where grouped queries are faster (#15287) About 2x speed-up on inboxes query --- app/models/form/account_batch.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/models/form') diff --git a/app/models/form/account_batch.rb b/app/models/form/account_batch.rb index 882770d7c..26d6d3abf 100644 --- a/app/models/form/account_batch.rb +++ b/app/models/form/account_batch.rb @@ -51,7 +51,7 @@ class Form::AccountBatch end def account_domains - accounts.pluck(Arel.sql('distinct domain')).compact + accounts.group(:domain).pluck(:domain).compact end def accounts -- cgit