Skip to content
Snippets Groups Projects
Unverified Commit ded299c0 authored by Andreas Brandl's avatar Andreas Brandl
Browse files

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
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -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
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment