The Rails application has a large or complex dataset. The application needs to export a CSV of the data or a subset of the data. When running the CSV generator it take too much time to process. ActiveRecord will convert each row of the query into Ruby objects. This convertion slows down the process.
Using a MySQL stream, we can write each row to the CSV without storing them in memory.