What
GemInfo.execute_raw_sql loads the entire compact index versions result set (~2M rows) into memory at once. PR #6627 streams one gem at a time when writing /versions, but the raw rows are still fully buffered first.
Follow-up from: #6627 (comment)
Why
Loading all the rows up front is the biggest chunk of memory the /versions job uses, and it keeps growing as more gems and versions are published. It's already pushed the job past ~1.7 GB and taken down staging workers. We should stop holding every row in memory at once — a quick spike using a batched SQL cursor kept RSS around ~600 MB.
Deliverables
What
GemInfo.execute_raw_sqlloads the entire compact index versions result set (~2M rows) into memory at once. PR #6627 streams one gem at a time when writing/versions, but the raw rows are still fully buffered first.Follow-up from: #6627 (comment)
Why
Loading all the rows up front is the biggest chunk of memory the
/versionsjob uses, and it keeps growing as more gems and versions are published. It's already pushed the job past ~1.7 GB and taken down staging workers. We should stop holding every row in memory at once — a quick spike using a batched SQL cursor kept RSS around ~600 MB.Deliverables
execute_raw_sqlso it doesn't buffer all rows at once (e.g. batched fetching), preserving ordering,.to_acompatibility, and byte-identical/versionsoutput — covered by tests.