There are certainly a lot of queries we have and will optimize, to see the work see https://gitlab.com/gitlab-com/operations/issues/42
BTW to prevent simple N+1 queries we use the Bullet gem https://gitlab.com/gitlab-org/gitlab-ce/blob/7ff974e38e24a9b...