Allow board issue filtering by iteration cadence ID in GraphQL
What does this MR do and why?
Allow board issue filtering by iteration cadence ID in GraphQL
GraphQL API adds the iterationCadenceId issue list filter for boards. iterationCadenceId can be used together with iterationWildcardID
How to set up and validate locally
Example Query
{
group(fullPath:"gitlab-org") {
board(id: "gid://gitlab/Board/4") {
lists(id: "gid://gitlab/List/12") {
nodes {
issues(filters: { iterationCadenceId: ["gid://gitlab/Iterations::Cadence/1"] }) {
nodes {
id
}
}
}
}
}
}
}
Database Plans
New Query (Avoids subquery for current iterations using activerecord merge)
https://console.postgres.ai/shared/c54d4427-5155-4fc7-b13c-cdfa2a398df0
RAW SQL
SELECT "issues".*
FROM "issues"
INNER JOIN "sprints"
ON "sprints"."id" = "issues"."sprint_id"
WHERE (
NOT EXISTS
(
SELECT 1
FROM "banned_users"
WHERE (
issues.author_id = banned_users.user_id)))
AND "issues"."project_id" = 278964
AND (
"issues"."state_id" IN (1))
AND "issues"."issue_type" IN (0,
1)
AND "sprints"."group_id" IN
(
SELECT "namespaces"."id"
FROM "namespaces"
WHERE "namespaces"."type" = 'Group'
AND "namespaces"."id" = 9970)
AND (
sprints.start_date <= '2021-11-16')
AND (
sprints.due_date >= '2021-11-16')
AND "sprints"."iterations_cadence_id" = 16671
AND (
EXISTS
(
SELECT "label_links".*
FROM "label_links"
WHERE "label_links"."target_type" = 'Issue'
AND (
"issues"."id" = "label_links"."target_id")
AND "label_links"."label_id" = 2526320 limit 1))
ORDER BY issues.relative_position ASC nulls last,
"issues"."id" ASC
Old Query (Uses a subquery to fetch current iterations)
https://console.postgres.ai/shared/eda4bbd1-0918-4043-9b0c-b9cb272986dc
RAW SQL
SELECT "issues".*
FROM "issues"
INNER JOIN "sprints"
ON "sprints"."id" = "issues"."sprint_id"
WHERE (
NOT EXISTS
(
SELECT 1
FROM "banned_users"
WHERE (
issues.author_id = banned_users.user_id)))
AND "issues"."project_id" = 278964
AND (
"issues"."state_id" IN (1))
AND "issues"."issue_type" IN (0,
1)
AND "issues"."sprint_id" IN
(
SELECT "sprints"."id"
FROM "sprints"
WHERE "sprints"."group_id" IN
(
SELECT "namespaces"."id"
FROM "namespaces"
WHERE "namespaces"."type" = 'Group'
AND "namespaces"."id" = 9970)
AND (
start_date <= '2021-11-15')
AND (
due_date >= '2021-11-15')
ORDER BY "sprints"."due_date" ASC,
"sprints"."title" ASC,
"sprints"."id" ASC)
AND "sprints"."iterations_cadence_id" = 16671
AND (
EXISTS
(
SELECT "label_links".*
FROM "label_links"
WHERE "label_links"."target_type" = 'Issue'
AND (
"issues"."id" = "label_links"."target_id")
AND "label_links"."label_id" = 2526320 limit 1))
ORDER BY issues.relative_position ASC nulls last,
"issues"."id" ASC
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #345204 (closed)
Edited by Mario Celi