How would you optimize a slow-running data pipeline that processes millions of historical insurance transactions?