Add feature flag for tablesample counting.
This commit is contained in:
parent
3a7d9b4b02
commit
3266642739
2 changed files with 8 additions and 0 deletions
|
@ -172,6 +172,10 @@ module Gitlab
|
|||
{}
|
||||
end
|
||||
|
||||
def self.enabled?
|
||||
Gitlab::Database.postgresql? && Feature.enabled?(:tablesample_counts)
|
||||
end
|
||||
|
||||
private
|
||||
def perform_count(model, estimate)
|
||||
# If we estimate 0, we may not have statistics at all. Don't use them.
|
||||
|
|
|
@ -163,6 +163,10 @@ describe Gitlab::Database::Count do
|
|||
end
|
||||
|
||||
describe '.enabled?' do
|
||||
before do
|
||||
stub_feature_flags(tablesample_counts: true)
|
||||
end
|
||||
|
||||
it 'is enabled for PostgreSQL' do
|
||||
allow(Gitlab::Database).to receive(:postgresql?).and_return(true)
|
||||
|
||||
|
|
Loading…
Reference in a new issue