Slow /api/albums endpoint #4293

Closed
opened 2026-02-05 10:00:44 +03:00 by OVERLORD · 8 comments
Owner

Originally created by @C-Otto on GitHub (Sep 11, 2024).

The bug

When the /api/albums endpoint is queried, for example when going to the albums page or trying to add assets to an album, this takes a lot of time. I'd like the response to be quicker, possibly with some details loaded in separate requests.

In my case, with a server I consider fast, with lots of dedicated RAM and fast SSDs for the database, the endpoint takes 903ms to load. I currently have 225 albums.

Related to #11071

The OS that Immich Server is running on

Debian Stable

Version of Immich Server

v1.114.0

Platform with the issue

  • Server
  • Web
  • Mobile
Originally created by @C-Otto on GitHub (Sep 11, 2024). ### The bug When the /api/albums endpoint is queried, for example when going to the albums page or trying to add assets to an album, this takes a lot of time. I'd like the response to be quicker, possibly with some details loaded in separate requests. In my case, with a server I consider fast, with lots of dedicated RAM and fast SSDs for the database, the endpoint takes 903ms to load. I currently have 225 albums. Related to #11071 ### The OS that Immich Server is running on Debian Stable ### Version of Immich Server v1.114.0 ### Platform with the issue - [X] Server - [X] Web - [ ] Mobile
Author
Owner

@mmomjian commented on GitHub (Sep 11, 2024):

Seems to be a duplicate of #11071 as you mentioned, what makes this a new issue?

@mmomjian commented on GitHub (Sep 11, 2024): Seems to be a duplicate of #11071 as you mentioned, what makes this a new issue?
Author
Owner

@C-Otto commented on GitHub (Sep 11, 2024):

It's not the browser that struggles, but the server. The issue is unrelated to the loading of thumbnails, as the endpoint only returns URLs. Switching to/from the list mode on the albums page is almost instant in my browser.

@C-Otto commented on GitHub (Sep 11, 2024): It's not the browser that struggles, but the server. The issue is unrelated to the loading of thumbnails, as the endpoint only returns URLs. Switching to/from the list mode on the albums page is almost instant in my browser.
Author
Owner

@mmomjian commented on GitHub (Sep 11, 2024):

How many albums do you have? Edit: I see 225. 900ms doesn’t seem crazy unreasonable enough to be a bug to me, but I’ll give it a bit for someone else to chime in.

@mmomjian commented on GitHub (Sep 11, 2024): How many albums do you have? Edit: I see 225. 900ms doesn’t seem crazy unreasonable enough to be a bug to me, but I’ll give it a bit for someone else to chime in.
Author
Owner

@mertalev commented on GitHub (Sep 11, 2024):

I'd imagine that fetching albums for the albums page should be at least an order of magnitude faster than that, possibly closer to two. There are a lot of queries that are just slow and unoptimized. While porting things over to the Kysely query builder, I've also been doing an optimization pass on these.

@mertalev commented on GitHub (Sep 11, 2024): I'd imagine that fetching albums for the albums page should be at least an order of magnitude faster than that, possibly closer to two. There are a lot of queries that are just slow and unoptimized. While porting things over to the Kysely query builder, I've also been doing an optimization pass on these.
Author
Owner

@danieldietzler commented on GitHub (Sep 21, 2024):

Should we close #11071 in favor of this one?

@danieldietzler commented on GitHub (Sep 21, 2024): Should we close #11071 in favor of this one?
Author
Owner

@C-Otto commented on GitHub (Sep 21, 2024):

No, these are different issues, see my comment above

@C-Otto commented on GitHub (Sep 21, 2024): No, these are different issues, see my comment above
Author
Owner

@SamueleLorefice commented on GitHub (Sep 23, 2024):

Just going to add... on loading the albums page on my end, the albums endpoint request takes 5.1s on the server to load. This is with around 6k albums. Creating albums takes around 1.5s/1.7s (Via direct API calls)

@SamueleLorefice commented on GitHub (Sep 23, 2024): Just going to add... on loading the albums page on my end, the albums endpoint request takes 5.1s on the server to load. This is with around 6k albums. Creating albums takes around 1.5s/1.7s (Via direct API calls)
Author
Owner

@danieldietzler commented on GitHub (Apr 1, 2025):

The album queries have been reworked recently and #11071 has been resolved with them. Closing this as it should've seen the same performance issues.

@danieldietzler commented on GitHub (Apr 1, 2025): The album queries have been reworked recently and #11071 has been resolved with them. Closing this as it should've seen the same performance issues.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#4293