Okay, I tried the `queryset_iterator` approach. Though it did do very well with memory management, the execution time remains pretty high (1500 seconds, compared to the original time of 1514 seconds). I event tried two different `chunksize` values: 1000 and 100000. 1000 gave us slightly lower memory requirements than 100000, but the execution times are the same.

With the current implementation, execution time drops to 500 seconds.