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

Performance fixes #1485

Merged
merged 5 commits into from
Sep 13, 2023
Merged

Performance fixes #1485

merged 5 commits into from
Sep 13, 2023

Conversation

sausage-todd
Copy link
Contributor

@sausage-todd sausage-todd commented Sep 13, 2023

Changes proposed ✍️

What

🤖 Generated by Copilot at 5359728

This pull request improves the database queries and data processing for segments and activity channels in the SegmentRepository. It also adds the application_name option to the database connection configuration in both the models and the connection modules, using the SERVICE environment variable to identify the source of the queries.

🤖 Generated by Copilot at 5359728

We are the masters of the database
We set the application_name to trace our fate
We optimize the queries with jsonb_merge_agg
We unleash the power of the SegmentRepository

Why

How

🤖 Generated by Copilot at 5359728

  • Add application_name option to database configuration and connection to identify query source (link, link)
  • Refactor bulk insert query of segmentActivityChannels table to improve performance and readability (link, link)
  • Use jsonb_merge_agg function to aggregate activity channels by segment and platform in queries of SegmentRepository (link, link, link)
  • Add segmentId column and DISTINCT modifier to join and aggregate activity channels correctly in queries of SegmentRepository (link, link, link)
  • Check for null or undefined activityChannels property before using spread operator in SegmentRepository (link, link)
  • Remove redundant assignment of activityChannels property in SegmentRepository (link)

Checklist ✅

  • Label appropriately with Feature, Improvement, or Bug.
  • Add screehshots to the PR description for relevant FE changes
  • New backend functionality has been unit-tested.
  • API documentation has been updated (if necessary) (see docs on API documentation).
  • Quality standards are met.

@sausage-todd sausage-todd merged commit 62c4f59 into main Sep 13, 2023
4 of 6 checks passed
@sausage-todd sausage-todd deleted the lf-perf1 branch September 13, 2023 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant