Skip to content

Add repo_statistics and gitserver_repos_statistics tables

Administrator requested to merge mrn/repo-stats into main

Created by: mrnugget

This adds two statistics tables that are purely populated via database triggers:

  • repo_statistics to hold information about the repo table (that's why it's repo_statistics and not repo*s*_statistics, because consistency)
  • gitserver_repos_statistics to hold information about the gitserver_repos table

Both tables allow us to cheaply query the number of cloned, cloning, not_cloned, soft_deleted, etc. repositories in a sourcegraph instance and we can even see how many repos are on which gitserver.

See this discussion for background: https://sourcegraph.slack.com/archives/C018CJQ5YBB/p1657276718654509

Demo video

https://user-images.githubusercontent.com/1185253/182858393-7b1b0d9e-b834-4a3d-bdbb-cc83a6dc62fb.mp4

Test plan

  • Lots of manual testing
  • Lots of testing in SQL REPL
  • Automated tests added

Merge request reports

Loading