Hard
SQL-O09sqlBatch Deletes To Avoid Locks
Problem
Deleting 50M rows in a single statement holds a lock and bloats the WAL. Write a batched-delete loop that processes 50K rows at a time. (Pseudo-SQL acceptable.)
Input
Conceptual + SQL pattern.
Output
Batched DELETE
Constraints
—
Sample input
—
Sample output
Loop with LIMIT 50000 until 0 rows affected.
Explanation
Long-running deletes bloat WAL and block readers; batch.
optimisationdeleteslocks@Yelp
Visible test cases
in: explain
out: ok
Your solution — run it, use AI if stuck
sql
