Scaling the GitLab database
This article is also very useful in showing just how far you can push Postgres _without_ reaching for any of these optimizations.  I've seen too many projects worry about these things very early on in their lifecycle, when in reality they are no where close to having enough traffic to cause a problem.