-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Added batch inserts for doctrine orm populate #1781
Added batch inserts for doctrine orm populate #1781
Conversation
Will fix #1471 |
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.
👍
Well, the PK drawback is serious and it should be documented. |
Added some docs of the negative impact on bigger amounts of data |
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.
Apart from a sentence which appears to be missing an ending, this looks good to me!
All comments have been handled and applied to the code |
@pimjansen please don't force push. Just add commits to the PR so that we can see what you did in reaction to the comments. I don't mind having several commits in a PR. Also, you haven't documented the |
… populator has a new batchSize parameter
Upgrading from 1.8 to 1.9, this commit seems to have broken our setup: Using the following code:
This addition seems to be the problem: |
Lost 2 hours to understand what was happening. Same here as jaapromijn : 1.9 is now broken for using faker with doctrine relations... |
Added a counter a batch size to insert in batches instead of all at once on which doctrine orm will block itself due the fact it holds all in memory.
Works fine and it reduces the memory consumption a lot. The smaller the batches the less memory it will consume but will be less fast as well.
Only problem that still remains is the return of the PKs inserted though. I don't think there is a real solution for that when you want to keep track of so much data. Did a test with 100k records for this though meaning it holds 100k PKs in an array.