Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Brandl <abrandl@gitlab.com>2019-03-11 16:50:13 +0300
committerAndreas Brandl <abrandl@gitlab.com>2019-03-12 22:03:52 +0300
commitded299c05b53ffdfbd0851771efaea3fe1ca7fed (patch)
treea854140230eebd3c04ea3147493585b4d5fc350c /lib/gitlab/database
parent27644f63fb147a4c1c7469faa3e16119552b11af (diff)
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