summaryrefslogtreecommitdiff
path: root/lib/gitlab/database
diff options
context:
space:
mode:
authorAndreas Brandl <abrandl@gitlab.com>2019-03-11 14:50:13 +0100
committerAndreas Brandl <abrandl@gitlab.com>2019-03-12 20:03:52 +0100
commitded299c05b53ffdfbd0851771efaea3fe1ca7fed (patch)
treea854140230eebd3c04ea3147493585b4d5fc350c /lib/gitlab/database
parent27644f63fb147a4c1c7469faa3e16119552b11af (diff)
downloadgitlab-ce-ded299c05b53ffdfbd0851771efaea3fe1ca7fed.tar.gz
Seed tablesample strategy
This produces stable approximate counts among invocations unless the table changed. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/58791.
Diffstat (limited to 'lib/gitlab/database')
-rw-r--r--lib/gitlab/database/count/tablesample_count_strategy.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/gitlab/database/count/tablesample_count_strategy.rb b/lib/gitlab/database/count/tablesample_count_strategy.rb
index 4fcd68b297d..7777f31f702 100644
--- a/lib/gitlab/database/count/tablesample_count_strategy.rb
+++ b/lib/gitlab/database/count/tablesample_count_strategy.rb
@@ -61,6 +61,7 @@ module Gitlab
SELECT (COUNT(*)*#{inverse})::integer AS count
FROM #{model.table_name}
TABLESAMPLE SYSTEM (#{portion * 100})
+ REPEATABLE (0)
#{where_clause(model)}
SQL