Service ping times out due to Service count

I noticed GitLab.com usage pings weren't going through, and then I found this Sentry error:

https://sentry.gitlap.com/gitlab/gitlabcom/issues/26258/

Unfortunately, it looks like the database statement timeout is occurring here:

 services: Service.where(active: true).count

/cc: @ernstvn, @regisF, @rdavila

It's probably due to a sequence scan since filtering by all active Services isn't really a common activity.

Assignee Loading
Time tracking Loading