-
Andreas Brandl authored
This is to support queries like the following: ```sql SELECT "projects".* FROM "projects" WHERE (EXISTS ( SELECT 1 FROM "project_authorizations" WHERE "project_authorizations"."user_id" = 1562869 AND (project_authorizations.project_id = projects.id)) OR projects.visibility_level IN (10, 20)) AND "projects"."pending_delete" = FALSE ORDER BY "projects"."updated_at" DESC, "projects"."id" DESC LIMIT 20 OFFSET 0; ``` With this change, we add indexes for all order_by options. The regularly sorted index (`asc, asc`) has the common name whereas the one with `desc, desc` is optimized for API calls. It may be subject to removal later (see https://gitlab.com/gitlab-org/gitlab/issues/195881). Relates to https://gitlab.com/gitlab-org/gitlab/issues/36390. A similar MR for unauthenticated calls is https://gitlab.com/gitlab-org/gitlab/merge_requests/22784.
39bcdf2a