-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
feat: improve performance for GET /api/album & /api/album/:id #17124
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
Merged
zackpollard
merged 5 commits into
immich-app:main
from
PathToLife:fix/album-list-performance
Mar 31, 2025
Merged
feat: improve performance for GET /api/album & /api/album/:id #17124
zackpollard
merged 5 commits into
immich-app:main
from
PathToLife:fix/album-list-performance
Mar 31, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
remove unnecessary join for getMetadataForIds remove separate call to getLastUpdatedAssetForAlbumId
… GET /api/album/:id also remove getLastUpdatedAssetForAlbumId query as it is no longer referenced
9e01573
to
966c3f2
Compare
mertalev
reviewed
Mar 26, 2025
mertalev
approved these changes
Mar 28, 2025
jrasm91
approved these changes
Mar 28, 2025
tests & lint still pass before this commit.
zackpollard
approved these changes
Mar 31, 2025
kirill-dev-pro
pushed a commit
to kirill-dev-pro/immich-but-with-public-albums-within-instance
that referenced
this pull request
Apr 6, 2025
…-app#17124) * fix(server) optimize number of sql calls for GET /api/albums remove unnecessary join for getMetadataForIds remove separate call to getLastUpdatedAssetForAlbumId * fix(server) remove unnecessary getLastUpdatedAssetForAlbumId call for GET /api/album/:id also remove getLastUpdatedAssetForAlbumId query as it is no longer referenced * fix(server): correct lastModifiedAssetTimestamp return type + formatting and typing * chore(server): address type issue with tests found via npm:check tests & lint still pass before this commit.
savely-krasovsky
pushed a commit
to savely-krasovsky/immich
that referenced
this pull request
Jun 8, 2025
…-app#17124) * fix(server) optimize number of sql calls for GET /api/albums remove unnecessary join for getMetadataForIds remove separate call to getLastUpdatedAssetForAlbumId * fix(server) remove unnecessary getLastUpdatedAssetForAlbumId call for GET /api/album/:id also remove getLastUpdatedAssetForAlbumId query as it is no longer referenced * fix(server): correct lastModifiedAssetTimestamp return type + formatting and typing * chore(server): address type issue with tests found via npm:check tests & lint still pass before this commit.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Performance improvement for GET /api/albums when there are >10K assets in multiple albums
This is a significant UX improvment for first load page performance and repeated navigation into and out of albums (depending on browser caching)
Query Times
Average BEFORE 1.78s
Average AFTER 0.67s
Difference -1.11s
Improvement 62.3%
From:

To:

Fixes # (issue)
How Has This Been Tested?
Find a server with albums at least 2-3 albums with over 30k assets in each
Remember to disable browser cache just in case

Checklist:
src/services/
uses repositories implementations for database calls, filesystem operations, etc.src/repositories/
is pretty basic/simple and does not have any immich specific logic (that belongs insrc/services/
)Thanks to @mertalev for helping with more indepth analysis of SQL queries! :)