Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
32666427
Commit
32666427
authored
Oct 28, 2018
by
Andreas Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add feature flag for tablesample counting.
parent
3a7d9b4b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
0 deletions
+8
-0
lib/gitlab/database/count.rb
lib/gitlab/database/count.rb
+4
-0
spec/lib/gitlab/database/count_spec.rb
spec/lib/gitlab/database/count_spec.rb
+4
-0
No files found.
lib/gitlab/database/count.rb
View file @
32666427
...
@@ -172,6 +172,10 @@ module Gitlab
...
@@ -172,6 +172,10 @@ module Gitlab
{}
{}
end
end
def
self
.
enabled?
Gitlab
::
Database
.
postgresql?
&&
Feature
.
enabled?
(
:tablesample_counts
)
end
private
private
def
perform_count
(
model
,
estimate
)
def
perform_count
(
model
,
estimate
)
# If we estimate 0, we may not have statistics at all. Don't use them.
# If we estimate 0, we may not have statistics at all. Don't use them.
...
...
spec/lib/gitlab/database/count_spec.rb
View file @
32666427
...
@@ -163,6 +163,10 @@ describe Gitlab::Database::Count do
...
@@ -163,6 +163,10 @@ describe Gitlab::Database::Count do
end
end
describe
'.enabled?'
do
describe
'.enabled?'
do
before
do
stub_feature_flags
(
tablesample_counts:
true
)
end
it
'is enabled for PostgreSQL'
do
it
'is enabled for PostgreSQL'
do
allow
(
Gitlab
::
Database
).
to
receive
(
:postgresql?
).
and_return
(
true
)
allow
(
Gitlab
::
Database
).
to
receive
(
:postgresql?
).
and_return
(
true
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment