Write result in CSV and in database on the flow to avoid memory crash with large array