Missing index on redirect_routes
The redirect_routes table is often queried with:
LOWER(redirect_routes.path) = LOWER('some constant')
However, there is no index across LOWER(redirect_routes.path), unlike the similar table routes, which does have a functional index using lower() across the path column.
Adding this index will improve performance of the queries against projects and namespaces where they join against redirect_routes with such a conditional involved. These queries appear to be run about 20 times per second, meaning that this index could reduce load substantially on the primary.