Optimize work items label filtering query performance
Problem
The work items label filtering query uses ~1GB of buffer and has suboptimal query plans.
Query Plan (without UNION)
https://console.postgres.ai/gitlab/gitlab-production-main/sessions/46337/commands/141400
Reproduce
Notes
- UNION was removed from label_links EXISTS clauses to simplify the query
- Original UNION query plan: https://console.postgres.ai/gitlab/gitlab-production-main/sessions/46337/commands/141398
- Even without UNION, the query still uses ~1GB of buffer and needs further optimization
Edited by 🤖 GitLab Bot 🤖