I was querying a Postgres table with about 4 million rows and writing some of the fields to a CSV.
I knew loading the rows into RAM was unacceptable, so I used the
MyBatis class ResultHandler
to process the records. The code ran fine locally, but in
production we were having memory usage issues.