From ded299c05b53ffdfbd0851771efaea3fe1ca7fed Mon Sep 17 00:00:00 2001 From: Andreas Brandl Date: Mon, 11 Mar 2019 14:50:13 +0100 Subject: [PATCH] Seed tablesample strategy This produces stable approximate counts among invocations unless the table changed. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/58791. --- lib/gitlab/database/count/tablesample_count_strategy.rb | 1 + 1 file changed, 1 insertion(+) 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