Code RoomCSV load memory and speed
MediumPrep Room Coding #4066

CSV load memory and speed

Vibe & agenticAlgorithms & data structuresMid–Senior~15 min

An AI agent wrote this Python ETL step to load a large CSV into Postgres. It works on the 10k-row sample. On the real 80M-row file it exhausts memory and, when run on a smaller file, takes hours.

Identify the scaling problems and how you'd rewrite this load.

Implement
plan_bulk_load(total_rows: int, chunk_size: int, batch_size: int) → list[int]
Examples
in[10,4,3]out[3,1,3,1,2]
in[5,10,2]out[2,2,1]
in[6,3,3]out[3,3]
What a strong answer looks like

Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it (tests, edge cases, reading critically), and how you’d re-prompt or decompose to get it right.

0:00 of about 15 min

Vibe & agentic: describe the solution in plain language (or narrate it) and the coach grades your approach.

Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.