Commit ded299c0 authored by Andreas Brandl's avatar Andreas Brandl

Seed tablesample strategy

This produces stable approximate counts among invocations unless the
table changed.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/58791.
parent 27644f63
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment