Skip to content

Conversation

@raymondjacobson
Copy link
Member

Improve library playlists/albums performance

  1. Filter on save_type = playlist instead of != track. albums fall under save_type = playlist anyway (checked prod db). This makes use of the index and takes the first query from ~1.5s to 2-300ms.
  2. Conditionally join on users
  3. Omit tracks in the fullplaylistskeyed query rather than post-facto

Tested:

  • Add new test (no coverage before)
  • Prod request with replaced URL

Copy link
Contributor

@dylanjeffers dylanjeffers left a comment

Choose a reason for hiding this comment

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

Thank you!

false as is_purchase
FROM saves
WHERE save_type != 'track'
WHERE save_type = 'playlist'
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice

@raymondjacobson raymondjacobson merged commit 1be381b into main Jul 7, 2025
3 checks passed
@raymondjacobson raymondjacobson deleted the rj-api-235 branch July 7, 2025 19:28
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.

4 participants