-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimise Export Memory Usage #9388
base: hotfix
Are you sure you want to change the base?
Optimise Export Memory Usage #9388
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Would be great to have this on import also, if not already there, so that users wouldn't have to continue to import large number of records by the command line. |
Hey @simonr44 ! However, I've noticed one possible issue. It seems as though it adds the Header row for each batch of records, back into the CSV. I've grabbed a CSV from pre-fix and post-fix. (left and right respectively), using the same dataset. After sorting A->Z on the "Name" header row, I noticed that there were now 110 extra rows that contained the header row items I imagine the CSV should only have the initial header row? Thank you! |
Description
This PR passes records to the export function in export_utils in small batches rather than all at once to minimise the memory consumption of the csv export process.
Motivation and Context
When exporting lots of records at one time, the php memory consumption can quickly exceed the default memory_limit
This change will process the records in small batches, consuming less memory.
Large exports of +/- 100k records can easily exceed 750MB peak memory consumption. With this change consumption remains below the php default value of 128MB ( Approx 74MB in testing, but will vary based on record contents )
How To Test This
Select all records on the list view and perform a bulk action export
Best performed on a test DB with many thousands of records.
Types of changes
Final checklist