Skip to content

perf(organizations): eliminate N+1 queries in listMembers and adminDelete#28777

Closed
diogeneszilli wants to merge 2 commits intocalcom:mainfrom
diogeneszilli:perf/orgs-eliminate-n-plus-1-queries
Closed

perf(organizations): eliminate N+1 queries in listMembers and adminDelete#28777
diogeneszilli wants to merge 2 commits intocalcom:mainfrom
diogeneszilli:perf/orgs-eliminate-n-plus-1-queries

Conversation

@diogeneszilli
Copy link
Copy Markdown

Summary

  • listMembers: Replace per-member enrichUserWithItsProfile() and attributeToUser.findMany() calls with batch operations, reducing from 2N queries to 2 queries
  • adminDelete: Replace N individual prisma.user.update() calls with a single batch $executeRaw UPDATE, and convert include to select to fetch only needed fields (id, username, name, slug)

Test plan

  • Verify listMembers returns the same response shape with batched enrichment
  • Verify adminDelete correctly renames all users in one batch UPDATE
  • Verify attribute expansion still works when expand includes "attributes"
  • Run yarn type-check:ci --force to confirm no type regressions

@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions
Copy link
Copy Markdown
Contributor

This PR has been marked as stale due to inactivity. If you're still working on it or need any help, please let us know or update the PR to keep it active.

@github-actions github-actions Bot added the Stale label Apr 15, 2026
@romitg2
Copy link
Copy Markdown
Member

romitg2 commented Apr 16, 2026

Thank you for your contribution. This PR is being closed because it modifies code that no longer exists in Cal.diy. blog

@romitg2 romitg2 closed this Apr 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants