Database Cursors: Row-by-Row Result Processing
A database cursor is an iterator for a query's results, letting you process a large dataset one row at a time. It's for batch jobs on huge record sets that would otherwise crash your app.
A database cursor is an iterator for a query's results, letting you process a large dataset one row at a time instead of loading everything into application memory. This is essential for batch jobs that need to perform complex logic on millions of records without causing an out-of-memory error. The main footgun is performance: cursors are almost always slower than set-based SQL operations and can hold locks for extended periods, which harms database concurrency.
Read the original → Wikipedia: Database cursor
- #databases
- #sql
- #architecture
- #performance
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.