mirror of
https://github.com/Donkie/Spoolman.git
synced 2026-10-22 01:52:17 -05:00
The spool listing already joins spool -> filament -> vendor, so joined eager loading of all three `extra` collections multiplied their rows together. With ~12 spool, ~9 filament and ~9 vendor extra fields, a single GET /spool?limit=30 made the database materialize ~35k wide rows (one per field combination) and then spent most of its time in SQLAlchemy de-duplicating them back into 30 objects. Switch the three `extra` relationships to lazy="selectin" so each collection is fetched in its own WHERE id IN (...) query and nothing multiplies. Measured on a 4911-spool SQLite database, GET /spool?limit=30 drops from 431 ms to 12 ms and limit=100 from 1358 ms to 23 ms, with byte-identical responses across the spool/filament/vendor/group/search endpoints and all 371 integration tests green on SQLite, PostgreSQL, MariaDB and CockroachDB. Claude-Session: https://claude.ai/code/session_014Cwk5Yyze9yPvkYkUtMAP4