Stale user deactivation performance
An AI wrote this Django management command to deactivate users who haven't logged in for a year. It runs nightly. On a 2-million-user table it takes hours and hammers the primary DB. Identify the inefficiency and rewrite it.
Implement
count_write_statements(stale_user_count: int, audit_batch_size: int, use_bulk_writes: bool) → intExamples
in
[200000,5000,true]out41in
[200000,5000,false]out400000in
[50,5000,true]out2What 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 16 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.
Run or narrate your approach, then ask the coach.