1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-10 13:56:47 +01:00
immich/server/src/domain/album
Michael Manganiello e262298090
fix(server): Split database queries based on PostgreSQL bound params limit (#6034)
* fix(server): Split database queries based on PostgreSQL bound params limit

PostgreSQL uses a 16-bit integer to indicate the number of bound
parameters.

This means that the maximum number of parameters for any query is 65535.
Any query that tries to bind more than that (e.g. searching by a list of
IDs) requires splitting the query into multiple chunks.

This change includes refactoring every Repository that runs queries
using a list of ids, and either flattening or merging results.

Fixes #5788, #5997.

Also, potentially a fix for #4648 (at least based on
[this comment](https://github.com/immich-app/immich/issues/4648#issuecomment-1826134027)).

References:

* https://github.com/typeorm/typeorm/issues/7565
* [PostgreSQL message format - Bind](https://www.postgresql.org/docs/15/protocol-message-formats.html#PROTOCOL-MESSAGE-FORMATS-BIND)

* misc: Create Chunked decorator to simplify implementation

* feat: Add ChunkedArray/ChunkedSet decorators
2024-01-06 20:36:12 -05:00
..
dto fix(web): new album title fix (#5467) 2023-12-04 16:22:31 +00:00
album-response.dto.spec.ts fix(server): Correctly set album start and end dates (#4698) 2023-10-31 05:08:34 -05:00
album-response.dto.ts fix(server): album perf query (#5232) 2023-11-21 10:07:49 -06:00
album.service.spec.ts fix(server): Split database queries based on PostgreSQL bound params limit (#6034) 2024-01-06 20:36:12 -05:00
album.service.ts fix(server): Split database queries based on PostgreSQL bound params limit (#6034) 2024-01-06 20:36:12 -05:00
index.ts refactor: domain repositories (#4403) 2023-10-09 14:25:03 +00:00