mirror of
https://github.com/rommapp/romm.git
synced 2026-11-29 18:11:16 +01:00
_attach_covers ranked every membership row with a window function and only then kept the first five per collection, so the collection list kept a full scan proportional to library size (0.77s of a 0.92s list on a 50k rom library) even though the view lookup itself is now indexed. Each collection instead gets its own primary-key lookup capped at MAX_VIRTUAL_COLLECTION_COVERS, batched into UNION ALL statements, so the cost follows the number of collections. The covers returned are unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>