I'm running out of memory on Heroku when try to export to csv 200 thousands records. This is not too much records so I think that active records is fetching data with inefficient way. How can I solve this problem?
Asked
Active
Viewed 743 times
0
-
1you can make the export in the background. – Andrey Deineko Sep 09 '15 at 13:33
-
200,000 is not that many records? How many columns are you exporting? Have you considered streaming or writing to the file in chunks rather than loading it completely into memory first? – engineersmnky Sep 09 '15 at 13:48
-
ActiveAdmin is streaming this csv to the client but it still consumpes a lot of memory. – Mateusz Urbański Sep 09 '15 at 13:49
1 Answers
1
You can first write CSV into file and send it to client after this. Here is a good answer how to write large amount of data efficiently.
I hope there is a way in ActiveAdmin to override default behavior of CSV download.
-
That is good idea. But I think that the problem maybe fetching filtered records in active admin and then export them to csv... – Mateusz Urbański Sep 09 '15 at 13:46