Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: Improve routing insights view #18557

Merged
merged 3 commits into from
Jan 9, 2025
Merged

Conversation

keithwillcode
Copy link
Contributor

@keithwillcode keithwillcode commented Jan 9, 2025

What does this PR do?

This view is experiencing some bad performance because the Attendee table has quite a lot of records. Instead of using a prefilled CTE, this moves the select into a subquery so we can directly reference the booking record instead, greatly improving perf.

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

Copy link

vercel bot commented Jan 9, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
cal ⬜️ Ignored (Inspect) Visit Preview Jan 9, 2025 4:24pm
calcom-web-canary ⬜️ Ignored (Inspect) Visit Preview Jan 9, 2025 4:24pm

@github-actions github-actions bot added the ❗️ migrations contains migration files label Jan 9, 2025
@keithwillcode keithwillcode added core area: core, team members only foundation labels Jan 9, 2025
@keithwillcode keithwillcode self-assigned this Jan 9, 2025
@keithwillcode keithwillcode marked this pull request as ready for review January 9, 2025 15:59
@graphite-app graphite-app bot requested a review from a team January 9, 2025 16:00
@keithwillcode keithwillcode added this to the v4.9 milestone Jan 9, 2025
Copy link

graphite-app bot commented Jan 9, 2025

Graphite Automations

"Add foundation team as reviewer" took an action on this PR • (01/09/25)

1 reviewer was added to this PR based on Keith Williams's automation.

"Add ready-for-e2e label" took an action on this PR • (01/09/25)

1 label was added to this PR based on Keith Williams's automation.

@dosubot dosubot bot added the performance area: performance, page load, slow, slow endpoints, loading screen, unresponsive label Jan 9, 2025
@keithwillcode keithwillcode added the High priority Created by Linear-GitHub Sync label Jan 9, 2025
b."createdAt" as "bookingCreatedAt",
b."startTime" as "bookingStartTime",
b."endTime" as "bookingEndTime",
(SELECT
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This subquery is the fix I referenced in the description.

This was a CTE before that couldn't reference b.id

Copy link
Member

@zomars zomars left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noice

Comment on lines +46 to +54
(SELECT
json_agg(
json_build_object(
'name', a.name, 'timeZone', a."timeZone", 'email', a.email
)
)
FROM "Attendee" a
WHERE "a"."bookingId" = b.id
) as "bookingAttendees",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👨‍🍳

@PeerRich PeerRich enabled auto-merge (squash) January 9, 2025 16:08
@PeerRich PeerRich merged commit 2fd8d24 into main Jan 9, 2025
40 checks passed
@PeerRich PeerRich deleted the perf/improve-routing-insights branch January 9, 2025 16:42
Copy link
Contributor

github-actions bot commented Jan 9, 2025

E2E results are ready!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core area: core, team members only foundation High priority Created by Linear-GitHub Sync ❗️ migrations contains migration files performance area: performance, page load, slow, slow endpoints, loading screen, unresponsive ready-for-e2e
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants