I also suggest you take a deep look at this:
You’re just looping over 200.000 records but you get 1.47M records instantiated (7 times the number of records you need) which is basically the same I already reported.
You can improve that situation a lot by:
- Lazy loading create_uid/write_uid
- Lazy loading all M2o fields
I would also do some checks with:
- Lazy loading write_date, create_date
- Lazy loading all the fields that you’re not using in the loop