Geo: count_verified_repositories doesn't scale

https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/9939 helps, but is insufficient.

From https://gitlab.com/gitlab-org/gitlab-ee/issues/10279#note_149179353

@mkozono I'm not sure about this. With cold caches, the query in https://gitlab.com/gitlab-org/gitlab-ee/issues/10279#note_148431459 still takes >15s (see below). Note that with warm caches, it's quite a lot faster (4s, second call below).

We already perform an index-only scan on the partial index here. It doesn't get much faster for the given criteria. The problem is that this returns some 8M records. I'm thinking this may be another use case for https://gitlab.com/gitlab-org/gitlab-ce/issues/52096 where we would be able to use a stateful transactional counter instead of counting things on demand, but I'm not sure.

Edited by 🤖 GitLab Bot 🤖