0

I have created a query using doctrine query builder which inserts almost 65000 rows(including all 3 tables) to 3 different tables at a time when something is performed.And for this complete process to finish it takes almost 2-3 mins to execute . What i have done is persist records in loops and then flush finally. So is there any ways that will minimize my execution time and inserts data within seconds.

anupkumar
  • 357
  • 4
  • 14
  • 28

1 Answers1

0

No, unfortunately Doctrine doesn't support grouping inserts into a single statement. If you need to do bulk inserts, one possibility is doing a $em->flush() and $em->clear() after every 100th or so row, see the manual's recommendation:

https://doctrine-orm.readthedocs.org/en/latest/reference/batch-processing.html

K. Norbert
  • 10,494
  • 5
  • 49
  • 48