Add index for last_activity_at order
This benefits the projects API for unauthenticated calls. Relevant query: ```sql SELECT "projects".* FROM "projects" WHERE "projects"."visibility_level" = 20 AND "projects"."pending_delete" = FALSE ORDER BY "projects"."last_activity_at" ASC, "projects"."id" DESC LIMIT 20 OFFSET 0 ``` Plan without index: https://explain.depesz.com/s/t73N Plan with index: https://explain.depesz.com/s/V45y Very similar for the `last_activity_at DESC` sort order. Relevant issue: https://gitlab.com/gitlab-org/gitlab/issues/36390 Related MR with more explanation: https://gitlab.com/gitlab-org/gitlab/merge_requests/22623
Showing
Please register or sign in to comment