diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-07 03:09:15 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-07 03:09:15 +0000 |
commit | 7ba5b9babaa5802c39e686c57cbf4a3f4725c4b0 (patch) | |
tree | 03a696c26f32e46faa46dd12d0a937d1d0d1cba4 /lib | |
parent | b56027c9d80ac0e297ba8a43c81e8504172dbf9f (diff) | |
download | gitlab-ce-7ba5b9babaa5802c39e686c57cbf4a3f4725c4b0.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/database/batch_count.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/gitlab/database/batch_count.rb b/lib/gitlab/database/batch_count.rb index 1faaac95575..3eb0197d178 100644 --- a/lib/gitlab/database/batch_count.rb +++ b/lib/gitlab/database/batch_count.rb @@ -56,6 +56,7 @@ module Gitlab def count(batch_size: nil, mode: :itself, start: nil, finish: nil) raise 'BatchCount can not be run inside a transaction' if ActiveRecord::Base.connection.transaction_open? raise "The mode #{mode.inspect} is not supported" unless [:itself, :distinct].include?(mode) + raise 'Use distinct count for optimized distinct counting' if @relation.limit(1).distinct_value.present? && mode != :distinct # non-distinct have better performance batch_size ||= mode == :distinct ? DEFAULT_DISTINCT_BATCH_SIZE : DEFAULT_BATCH_SIZE |