Approximate counting: Seed tablesample strategy
We employ table sampling to implement approximate counting in Gitlab::Database::Count::TablesampleCountStrategy
. The numbers produced vary from call to call (https://gitlab.com/gitlab-org/gitlab-ce/issues/55269#note_124527736).
The proposal here is to seed the tablesampling to achieve stable approximate counts. TABLESAMPLE
produces the same number on subsequent calls unless the table changed meanwhile. See https://www.postgresql.org/docs/9.6/sql-select.html.
cc @stanhu