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
https://console.postgres.ai/gitlab/gitlab-production-main/sessions/46337/commands/141400
Reproduce
Notes
- UNION is about to removed from label_links EXISTS clauses to simplify the query (!214259)
- 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 🤖