Skip to content

Draft: Added scope for sorting all project_statistic display columns

Suraj Tripathi requested to merge issue_389424_sort_all_proj_columns into master

What does this MR do and why?

Adds options to namespace projects GraphQL resolver to sort by multiple column's in ascending and descending order.

ref: https://gitlab.com/gitlab-org/gitlab/-/issues/389424

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

DB Queries

In scope of this task one new query was introduced (with ASC and DESC sorting), and one was modified (all three are ActiveRecord-driven queries)

New query introduced:

I am using the same query that was added as part of this MR, just opening that query for a 7 columns.

SELECT "projects".*, "project_statistics"."storage_size" AS project_statistics_storage_size FROM "projects" INNER JOIN "project_statistics" ON "project_statistics"."project_id" = "projects"."id" WHERE "projects"."namespace_id" IN (SELECT namespaces.traversal_ids[array_length(namespaces.traversal_ids, 1)] AS id FROM "namespaces" WHERE "namespaces"."type" = 'Group' AND (traversal_ids @> ('{22}'))) ORDER BY "project_statistics"."storage_size" ASC NULLS FIRST, "projects"."id" DESC LIMIT 21

Query plan with namespace.id = 1701395: https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/16208/commands/55596

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Suraj Tripathi

Merge request reports