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

Speed up remixables query by a lot #1651

Merged
merged 1 commit into from
Jul 15, 2021
Merged

Conversation

raymondjacobson
Copy link
Member

@raymondjacobson raymondjacobson commented Jul 15, 2021

Description

What is the purpose of this PR? What is the current behavior? New behavior? Relevant links (e.g. Trello) and/or information pertaining to PR?

Use aggregate_track for counting scores for remixables. This is far more performant. Query takes < 0.5s. There's an offline job here: https://github.com/AudiusProject/audius-protocol/blob/cefbc039c533797ae78584cd5f8c3dc1bbc3841b/discovery-provider/src/tasks/index_aggregate_views.py
that computes summed repost + save counts for all tracks.

The rest of explore should be refactored to use this, but since the playlists/albums and saves/reposts for playlists/albums is generally much smaller, it doesn't have as gnarly as a performance situation.

Sorry the diff here is a bit large -- autoformatting FTW though. The only change is the count_subquery

Tests

List the manual tests and repro instructions to verify that this PR works as anticipated. Include log analysis if possible.
❗ If this change impacts clients, make sure that you have tested the clients ❗

  1. Ran locally and exported the raw SQL and tested against prod data
    ...

❗ Reminder 💡❗:
If this PR touches a critical flow (such as Indexing, Uploads, Gateway or the Filesystem), make sure to add the requires-special-attention label. Add relevant labels as necessary.

How will this change be monitored?

For features that are critical or could fail silently please describe the monitoring/alerting being added.

Kyle-Shanks
Kyle-Shanks previously approved these changes Jul 15, 2021
@raymondjacobson raymondjacobson merged commit 5629dc0 into master Jul 15, 2021
@raymondjacobson raymondjacobson deleted the rj-speed-up-remixables branch July 15, 2021 16:09
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

2 participants