Bishwa Hang Rai activity https://gitlab.com/bhrai 2026-03-18T16:27:34Z tag:gitlab.com,2026-03-18:5218017929 Bishwa Hang Rai commented on merge request !142820 at GitLab.com / www-gitlab-com 2026-03-18T14:46:45Z bhrai Bishwa Hang Rai

Thank you all for the approval.

Congrats @div.ya for being CDot backend maintainer! Happy Merging! 🎉

tag:gitlab.com,2026-03-17:5211800559 Bishwa Hang Rai commented on issue #16507 at GitLab.org / customers-gitlab-com 2026-03-17T09:30:25Z bhrai Bishwa Hang Rai

Hi @qzhaogitlab , as discussed in our 1:1, also adding you to this SPIKE issue to explore entitlements current friction points and future architecture from groupprovision .

tag:gitlab.com,2026-03-16:5209158527 Bishwa Hang Rai commented on issue #16516 at GitLab.org / customers-gitlab-com 2026-03-16T16:16:56Z bhrai Bishwa Hang Rai

Hi @qzhaogitlab , could you please review this issue and see what would be the expected behaviour?

tag:gitlab.com,2026-03-16:5209142383 Bishwa Hang Rai commented on merge request !222168 at GitLab.org / GitLab 2026-03-16T16:13:29Z bhrai Bishwa Hang Rai

Thanks @peanutandlevi for the query link.

Query performance concern with positioned scope ordering

The query plan without the composite index shows that even with LIMIT 21 (as applied by pagination), all child rows are fetched before the limit takes effect:

  • https://console.postgres.ai/gitlab/gitlab-production-main/sessions/49857/commands/148300
  • Execution: 972ms (cold cache), 789 nested loop iterations
  • The existing index index_work_item_parent_links_on_work_item_parent_id finds all children for the parent, but returns them in index order (by work_item_parent_id), not in relative_position order
  • PostgreSQL must fetch all 789 rows, do 789 PK lookups on issues, then top-N heapsort to take 21
  • The LIMIT 21 only saves time on the sort step, not on the row fetching

With a composite index on (work_item_parent_id, relative_position ASC NULLS LAST, id ASC):

CREATE INDEX CONCURRENTLY index_work_item_parent_links_on_parent_id_position_and_id ON work_item_parent_links (work_item_parent_id, relative_position ASC NULLS LAST, id ASC);

The existing single-column index on work_item_parent_id is a prefix of this composite index, so it could potentially be dropped since the new composite index would cover the same lookups. That should be verified against existing queries before removing it.

It would be helpful to see the query plan for the current implementation on master (Epic.related_issues through epic_issues) for the same epic to compare the baseline. Depending on the regression, this could either be included as a migration in this MR or tracked as a follow-up. WDYT?