Files
bo0tzz ac453b5557 perf(server): stop aggregating every album asset when loading a shared link (#32412)
SharedLinkRepository.get (shared link page load, /shared-links/me, and the
OpenGraph tags rendered for /share/:key) json_agg'd every asset of the
album, with its full exif row, ordered by fileCreatedAt. The only things
used from it are the asset count and the first/last localDateTime.

Load the album without assets and fill assetCount/startDate/endDate from
getMetadataForIds, which is what GET /albums/:id already uses. The counts
now also respect the default visibility filter, and the dates are
formatted the same as on /albums/:id.

150k-asset album link, PG 14:

|                        | before          | after  |
|------------------------|-----------------|--------|
| query                  | 4.2-6.5 s       | ~0.26 s (metadata aggregate) |
| JSON built by postgres | 261 MB          | -      |
| GET /shared-links/me   | -               | 0.28 s, 961 B |
2026-10-13 18:39:08 -04:00
..